>
>
> We have been testing this PR and it is working for us, but we did have to
> deal with local storage migration.
Also "executeScript" seens not being working with localStorage, example:
```
var APP = window.APP = window.APP || {};
(function (base) {
"use strict";
this.isCordova = !!window.cordova;
this.startUrl = 'https://github.com/apache/cordova-plugin-inappbrowser';
this.appWindow = null;
this.popupConfig =
'hidden=no,location=no,toolbar=no,zoom=no,hidespinner=yes,usewkwebview=true';
this.loadUrl = function () {
if (APP.isCordova) {
try {
APP.appWindow =
cordova.InAppBrowser.open(APP.startUrl, '_blank', APP.popupConfig);
} catch (e) {
alert('ERROR.InAppBrowser:' +
JSON.stringify(e));
};
} else {
try {
APP.appWindow = window.open(APP.startUrl,
'_blank', APP.popupConfig);
} catch (e) {
alert('ERROR.open:' + JSON.stringify(e));
};
};
alert('appWindoe.typeof:' + (typeof APP.appWindow));
if (APP.appWindow) {
APP.appWindow.addEventListener('loadstart', function ()
{
alert('loadstart');
});
APP.appWindow.addEventListener('loadstop', function () {
alert('loadstop');
APP.appWindow.executeScript({
code: "localStorage.setItem('keyTest',
'keyValue')"
}, function () {}, function () {
alert('setItem=' +
JSON.stringify(arguments));
APP.appWindow.executeScript({
code:
"localStorage.getItem('keyTest')"
}, function () {}, function () {
alert('getItem=' +
JSON.stringify(arguments)); //should print something with "keyValue" but prints
""
});
});
});
APP.appWindow.addEventListener('loaderror', function ()
{
alert('loaderror');
});
APP.appWindow.addEventListener('exit', function () {
alert('exit');
});
};
};
this.onDeviceReady = function () {
alert('onDeviceReady');
try {
APP.loadUrl();
} catch (e) {
alert('ERROR.loadUrl:' + JSON.stringify(e));
};
};
var callReady = function () {
try {
APP.onDeviceReady();
} catch (e) {
alert('ERROR.callReady:' + JSON.stringify(e));
};
};
var readyTimeout = 3000;
if (this.isCordova) {
if (document.addEventListener) {
document.addEventListener('deviceready', function () {
callReady();
}, false);
} else {
setTimeout(function () {
callReady();
}, readyTimeout);
}
} else {
if (window.addEventListener) {
window.addEventListener('load', function () {
callReady();
}, false);
} else {
setTimeout(function () {
callReady();
}, readyTimeout);
};
};
}).call(window.APP);
```
[ Full content available at:
https://github.com/apache/cordova-plugin-inappbrowser/pull/271 ]
This message was relayed via gitbox.apache.org for [email protected]