I am building an ionic app and using the cordova inappbrowser plugin. From within my App I need to open an external web page using the inappbrowser. On this web page I need to provide a custom close button to the user, which closes the browser window when clicked.
I have looked at a number of existing threads such as Phonegap build - Open external page in InAppBrowser or childbrowser with no toolbar and close it?
window.close equivalent in Phonegap with InAppBrowser
While I am able to get inappbrowser window to open my url using
window.open('http://myurl.com', '_blank', 'location=no').
I am not able to close the inappbrowser window using the approaches suggested.
When I use
var ref = window.open(encodeURI(url), '_blank', options);
ref.addEventListener('loadstop', function(event) {
if (event.url.match("mobile/close")) {
ref.close();
}
});
However the link on the webpage
<a href="/mobile/close">Close</a>
does not close the inappbrowser window. On clicking it shows a 404 not found error.
I have also tried impossible to close inAppBrowser window [Solved] But no success. Please help. Thanks