[
https://issues.apache.org/jira/browse/CB-7179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16630223#comment-16630223
]
ASF GitHub Bot commented on CB-7179:
------------------------------------
rafaelberrocalj edited a comment on issue #271: CB-7179 (iOS): Add WKWebView
support for iOS
URL:
https://github.com/apache/cordova-plugin-inappbrowser/pull/271#issuecomment-422866201
>
>
> 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);
```
edit: it's working 👍
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [InAppBrowser][iOS 8] Update to support WKWebView
> -------------------------------------------------
>
> Key: CB-7179
> URL: https://issues.apache.org/jira/browse/CB-7179
> Project: Apache Cordova
> Issue Type: Sub-task
> Components: cordova-plugin-inappbrowser
> Environment: iOS 8
> Reporter: Shazron Abdullah
> Priority: Major
>
> support dual use with UIWebView
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]