Hello,
In “About” view I have following function:
$scope.exturl = function() {
var url = "http://www.aaa123.com";
var ref = window.open(url, '_blank', 'location=no');
};
In HTML I have:
<p>
See <a href="" ng-click="exturl()">Privacy Policy</a>
</p>
However when I press on link and it redirects me to the site, I try to press on back button - nothing happens.
So I have no idea how to get back to application.
[EDIT]
I run on Android,
I installed org.apache.cordova.inappbrowser
plugin:
cordova plugin add org.apache.cordova.inappbrowser
In config.xml
I see:
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" />
</feature>
I changed my method to:
$scope.exturl = function() {
var url = "http://www.aaa123.com";
window.open(url, '_system', 'location=yes');
return false;
};
Still the same problem.
Thanks,
1 Like
If this is ios and you have the inappbrowser installed, it should present you with a done button to close the browser. If this is android, you should have an X
button in the browser bar.
please see my edit. Yes, I installed this plugin but back button doesn’t work. I don’t see “X” button in browser. Sounds like it opens default browser
Solution:
I didn’t run:
cordova prepare ios
cordova prepare android
It should activate plugin.
The other way that works for me is:
navigator.app.loadUrl(url, { openExternal:true });
Here you don’t need any plugin
2 Likes
Could you please elaborate how did you get to go back to the app ?
According to this: http://stackoverflow.com/questions/27137119/where-is-navigator-app-documentation
The navigator.app object is not documented and is platform-dependant, so if someone is going to use it, should check first the implications of that…
On the other hand, the inappbrowser is working fine, I replaced the window.open calls with:
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
documentation for it: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
Perfect, i really need this… thanks
how to go back from external url to app pages using trigger event ?
please let me know process
i have struck with redirecting url from web view to app ?
1 Like
I am facing the same issure. But no one is sharing any clue to get back to the app from the inappbrowser. If i press back button from InAppBrowser, it closes my application also. Any hint?
In Ionic 3, You Can use close() to perform this operation.
example:
import {InAppBrowser, InAppBrowserEvent} from '@ionic-native/in-app-browser'; //import
Private inAppBrowser:InAppBrowser; //in your contructor
let browser = this.inAppBrowser.create('https://www.dreamvisionary.com', '_blank', 'location=yes'); //This will open link in InAppBrowser
browser.on('loadstart').subscribe((event:InAppBrowserEvent)=>
{
var closeUrl = 'https://www.dreamvisionary.com/thankyou';
if(event.url == closeUrl)
{
browser.close(); //This will close InAppBrowser Automatically when closeUrl Started
}
});
Above code working on Native Device…
Sorry i am facing this issue in ionic-v3
any solution for this type case ?
for example we have stripe checkout page into ionic app then if we open into inappbrowser then how to back to app open page from where checkout started?