问题
Hi I'm working around with jquery mobile and cordova 3 on a android device.
Everything works great except that I can't open links in the default browser or for example the maps application.
I can open it with a inappbrowser plugin but I dont want to do that. I just want to open the links to websites with the default browser.
I tried many things like here:
Opening Link in System Browser in PhoneGap 3.3 on Android
Open Links in Default Browser using Phonegap/Cordova
But I saw that the answers are showing the solution with the inappbrowser which I dont want.
How can I solve this?
Thanks for any help
回答1:
For Android OS use following code.
navigator.app.loadUrl("http://google.com", {openExternal : true});
or through inline JavaScript:
<a onclick="navigator.app.loadUrl('https://google.com/', { openExternal:true });">Link</a>
It will NOT work with iOS, also, I don't know, if currently exist a solution for iOS, that don't require inappbrowser.
来源:https://stackoverflow.com/questions/23836560/open-a-link-in-the-default-browser-of-a-system-with-cordova-3-and-jquery-mobile