Enterprise Browser WebSQL - Custom Code not working

M Michael Kempe 3 years 7 months ago
7 0 0

Hello!

My name is Michael and I'm a software developer for a food industry manufacturer. These are my first experiences developing an app for Zebra Device.

I'm developing a JavaScript solution for Enterprise Browser (Version 1.8.0.0) on MC9200. For this solution, I need the possibility to store/fetch data offline. My approach is to use the WebSQL support of the Enterprise Browser.

Generally I got the featured demo work. But my custom code does not want to work on the device within the Enterprise Browser. As described in the sample applications, it is possible to test the WebSQL code on the client side, because there is no need for EB-JavaScript-API. So I tested my code on my computer an there it worked as expected?!?!

Here is the content of my custom code file (only for testing):

DOCTYPE html>

  
  
  
   DB Test
  
  

  
   DB Test
  
  
  
  

  
   0. Zurück
  
  
   //document.onkeyup = KeyCheck;

   function KeyCheck(e) {
   var KeyId = (window.event) ? event.keyCode : e.keyCode;

   switch (KeyId) {
   case 48:
   window.location = "test.html";
   break;
  }
  }

   function fnGetData() {
        document.getElementById("output").innerHTML = '';
        if (window.openDatabase) {
             var db = openDatabase('test', '1.0', 'testdb', 2000);
             db.transaction(function (tx) {
                  tx.executeSql('CREATE TABLE IF NOT EXISTS Symbol (value TEXT)'),
                  tx.executeSql('INSERT INTO Symbol (value) VALUES ("Hallo")'),
                  tx.executeSql("SELECT * FROM Symbol", [], function (tx, result) {
                       document.getElementById("output").innerHTML = 'Anzahl DS: ' + result.rows.length;
                       for (let i = 0, record = null; i result.rows.length; i++) {
                            record = result.rows.item(i);
                            document.getElementById("output").innerHTML += record['value'] + '';
                      }
                 });
            });
         }
        else {
             window.alert("No Database support");
       }
  }

  

The Log.txt file for Enterprise Browser lists different information/warning messages, but I don't understand, why my function "fnGetData" is recognized like it would be a variable:

I 06/25/2018 09:51:47:463 0a06031e           MainWindow| Get activate from child window. Skip it.
I 06/25/2018 09:51:47:464 0a06031e     Core::CSync::Run| Running Event:
I 06/25/2018 09:51:47:465 0a06031e     Core::CSync::Run| Posting Message for:
I 06/25/2018 09:51:47:465 0a06031e           MainWindow| ACTIVATE: 0
I 06/25/2018 09:51:47:465 0a06031e           MainWindow| Get deactivate before first navigate. Skip it.
I 06/25/2018 09:51:47:480 0a06031e           MainWindow| OnSettingChange: 250
I 06/25/2018 09:51:47:539 0a06031e           MainWindow| OnTitleChangeCommand
I 06/25/2018 09:51:47:540 0a06031e              WebView| Page load complete.
I 06/25/2018 09:51:47:540 0a06031e     Core::CSync::Run| Running Event:
I 06/25/2018 09:51:47:540 0a06031e     Core::CSync::Run| Posting Message for:
I 06/25/2018 09:51:47:541 0a06031e           MainWindow| ZoomPageOnTab return : 1
I 06/25/2018 09:51:47:845 0a06031e               NewORM| calling useNewOrm
I 06/25/2018 09:51:47:861 0a06031e RhoWKBrowserEngine.cpp: 714| JS Log: http://127.0.0.1:8082/dbtest.html, line 46: SyntaxError: Expected token 'in'

I 06/25/2018 09:51:47:873 0a06031e RhoWKBrowserEngine.cpp: 627| before calling dominjector
I 06/25/2018 09:51:47:946 0a06031e     Core::CSync::Run| Running Event:
I 06/25/2018 09:51:47:946 0a06031e     Core::CSync::Run| Posting Message for:
I 06/25/2018 09:51:47:947 0a06031e Core::CMeta::GetModule| Plug-in: viewportcannot be found in Plugin.xml
W 06/25/2018 09:51:47:947 0a06031e Core::CMeta::SetPlugProperty| Module viewport not found.
I 06/25/2018 09:51:47:947 0a06031e Core::CMeta::GetModule| Plug-in: xcannot be found in Plugin.xml
W 06/25/2018 09:51:47:947 0a06031e Core::CMeta::SetPlugProperty| Module x not found.
I 06/25/2018 09:51:48:979 0a06031e     Core::CSync::Run| Running Event:
I 06/25/2018 09:51:48:979 0a06031e     Core::CSync::Run| Posting Message for:
I 06/25/2018 09:51:48:981 0a06031e           MainWindow| ACTIVATE: 1
I 06/25/2018 09:51:48:981 0a06031e           MainWindow| RhoSetFullScreen: 1
I 06/25/2018 09:51:48:982 0a06031e           MainWindow| SPI_GETWORKAREA: x=240;y=294
I 06/25/2018 09:51:48:982 0a06031e           MainWindow| resizeWindow: xSize=240;ySize=320
I 06/25/2018 09:51:48:982 0a06031e           MainWindow| ResizeOnTab..
I 06/25/2018 09:51:48:985 0a06031e           MainWindow| Get activate from child window. Skip it.
I 06/25/2018 09:51:48:986 0a06031e           MainWindow| OnLicenseScreen
I 06/25/2018 09:51:52:527 0a06031e RhoWKBrowserEngine.cpp: 714| JS Log: http://127.0.0.1:8082/dbtest.html, line 17: ReferenceError: Can't find variable: fnGetData

As attachements you will find the code file, the log.txt and the config.xml file.

Any suggestion?

Thank you in advance.

With kind regards

Michael

CONTACT
Can’t find what you’re looking for?