- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi guys,
anyone know how to show message if inAppBrowser failed?
i mean if no connection per example, how to redirect to another webpage?
Thanks.. :)
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like InAppBrowser varies from typical plugins in a couple ways. First' it starts with a Capital letter. More relevant is the fact that unlike most Cordova plugins, rather than taking 'success' and 'fail' callbacks, it relies on events. I'm guessing this is because it's trying to be a "drop-in replacement for the window.open() function". Thus as soon as you open the new window, you can set an event listener to catch an error:
x = cordova.InAppBrowser.open('https://bad.url.com', '_blank'); x.addEventListener('loaderror', function () {alert("ERROR");});
I don't know if there may be synch problems with this (i.e. addEventListener doesn't execute until after 'loaderror' fires) but it seemed to work for me in the debugger.
There are several other events as well. You can find more details here:
https://www.npmjs.com/package/cordova-plugin-inappbrowser
Good luck, and let us know if that works.
Dale

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page