Open a link in the default browser of a system with cordova 3 and jquery mobile

不羁岁月 提交于 2020-02-05 05:20:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!