- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Guys,
I'm developing an Hybrid app. In IOS the external links are not working with back button. Whenever I click the external link in the app, the link open in a new browser without back button. Also I have close the app and re-launch the app when I click the external link , Here my HTML Code,
var url = "https://google.com";
window.open(url, '_blank', 'location=yes');
Also I have used,
window.open(url, '_system', 'location=yes');
Thanks in advance
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should check out the Cordova plugin for in app browser. It will open in link in a view, inside your app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi John,
I'm trying to build Hybrid app using HTML5 & Angular JS (build IOS) and I just added InAppBrowser(0.5.4) through project explorer. I'm using an anchor tag for calling an external link as,
<a ng-click="openexternallink()">XXXX</a>
and from my controller,
$scope.openexternallink= function(){
var url = "http://platform.fatsecret.com";
cordova.InAppBrowser.open(url, '_blank', 'location=yes,closebuttoncaption=Done');
}
but it does not works. I'm just using Cordova Hybrid build for an IOS, but when I try to work with windows.open method like,
window.open(url, '_system', 'location=yes');
It works but I have close the application to come back to application ( without back button).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See the docs for the inAppBrowser plugin here https://github.com/apache/cordova-plugin-inappbrowser
This function works in my demo app:
// in app browser
function openBrowser()
{
var ref = window.open('http://www.espn.com', '_blank', 'location=yes');
ref.addEventListener('loadstart', function(event) { alert('start: ' + event.url); });
ref.addEventListener('loadstop', function(event) { alert('stop: ' + event.url); });
ref.addEventListener('loaderror', function(event) { alert('error: ' + event.message); });
ref.addEventListener('exit', function(event) { alert(event.type); });
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using window.open() with the inAppBrowser is not a reliable tactic, the window.open() function can get redefined after inAppBrowser has commandeered it. Try using the inAppBrowser function calls directly. If you cannot do that, you may need to manually redefine window.open() yourself, as shown in the docs that John points to, above.
See this paragraph, in particular, taken from the inAppBrowser docs:
For backwards compatibility, this plugin also hooks
window.open
. However, the plugin-installed hook ofwindow.open
can have unintended side effects (especially if this plugin is included only as a dependency of another plugin). The hook ofwindow.open
will be removed in a future major release.

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