I have this weird problem with iOS Cordova.
What I do is opening a new InAppBrowser with this line:
app.ref = cordova.InAppBrowser.open(url, '_blank', 'location=no,toolbar=no');
I listen for the loadstop
event with this line:
app.ref.addEventListener('loadstop', app.loadStopFunction);
The loadStopFunction
looks like this:
function loadStopFunction () {
console.log('loadStopFunction')
app.ref.executeScript({
code: `1+1`
});
}
This, unfortunately, triggers a side reload and that results in an infinite loop (because the loadstop
event is triggered repeatedly.
When I do the executeScript
later it works and no infinite loop is triggered:
function loadStopFunction () {
console.log('loadStopFunction')
setTimeout(function () {
app.ref.executeScript({
code: `1+1`
});
}, 350)
}
Any idea what could be wrong?
I do not have much experience with Cordova or even iOS, so there will be information missing I'm sorry.
package.json shows me this values:
...
"cordova-ios": "^4.5.5",
"cordova-plugin-inappbrowser": "^1.7.2",
...