Here is my code of closing the in app browser after reaching a specific URL in ionic version 1 (BTW i am new to ionic & angularjs). Here my problem is the event raised on “loadstart” is MouseEvent i couldn’t find any url in the object i am getting undefined error on console.log(event.url) . I tried with Loadstop and exit too in the event listener.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
function onExit(event) {
var urlSuccessPage = "https://tick.com/s";
alert(event);
alert(event.url);
console.log(event.url);
console.log(event);
if (event.url == urlSuccessPage) {
inAppBrowser.close();
}
}
var inAppBrowser = window.open("https://tick.com", "_blank", "location=yes");
inAppBrowser.addEventListener('loadstart', onExit(event));
}
Thanks in advance