Web App Client User Offline Mode
9.9B
The Sunbelt PL/B Web Client App(s) have been modified to support a user 'offline' mode where the 'plbwebcli' client loads a user web app that contains a HTML body, CSS file, and JavaScript file from the local persistent storage to only run on the mobile device. In this case, the user web app can run without any internet or network connection to a PWS server.
Note the following:
1. Once
the user web files ( html, css, javascript ) are loaded, the Plbwebcli client starts the user web app
by executing a javascript function named 'programStart' which must be included in the user provided javascript
routines.
Example of a user 'programStart' function:
function programStart() {
$("#btem").on("click", function(){processDir(LocalFileSystem.TEMPORARY);} );
$("#bper").on("click", function(){processDir(LocalFileSystem.PERSISTENT);} );
$("#bfil").on("click", function(){writeSampleFile();});
$("#bonl").on("click", function(){ location.replace("plbappload.html");});
$("#bflv").on("click", function() {viewFile();});
$("#bflr").on("click", function() {removeFile();});
$("#bwrt").on("click", function() {writeFile();});
$("#desktop").pagecontainer("change", "#main",{ transition: "flip"
});
}
2. When the user web app is completed, it can return to the main PlbWebCli page as follows:
Execute the following JavaScript operation:
location.replace("plbappstart.html");
As second option is to restart\run a PL/B program assuming that the mobile device has an internet or network connection to get access to PWS server.
Without changing any session variables, the 'plbappload.html' page can be loaded and the last PL/B program will be re-run.
location.replace("plbappload.html");
By changing the following session variables and then load\execute the 'plbappload.html' page causes another PL/B program to be loaded and executed.
sessionStorage.plbAddr = elAddr.value;
sessionStorage.plbProg = elProg.value;
sessionStorage.plbCid = elCid.value;
sessionStorage.plbOpt = elOpt.value;
location.replace("plbappload.html");
3. There are two flavors provided for the 'plbwebcli' offline mode.
One flavor has jQuery mobile support.
Another flavor does not have jQuery mobile support.
4. The user web app files (html, css, and javascript files) can be moved to the mobile device using the CLIENT object 'AppDownLoad' method.
Example:
In this case, all of the user ( html, css, and javascript ) files have been placed in a directory accessible by the PWS server as follows:
"c:\sunbelt\http_root\offline"
t1.css - Sample user css file
t1.html - Sample user html file
t1.js - Sample user javascript file
userdata.json - Sample JSON data used by user web app.
The Client.AppDownLoad method moves the files to the mobile device persistent storage path referenced as follows:
"cdvfile://localhost/persistent"
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5. The PL/B Web Server CLIENT object has been modified to provide the following new methods that support the 'Plbwebcli' client offline mode installation and administrative operations. These new CLIENT methods can only be executed in a PL/B program executed from a 'Plbwebcli' client that is connected to a PWS server.
See Also: Web App Client Command Line
![]() |