PhoneGap: Open external link in default browser (outside the app)

前端 未结 16 1705
我在风中等你
我在风中等你 2020-12-09 15:36

I\'m trying to open links in Safari (on an iPhone) from a PhoneGap application. I\'m using PhoneGap version 3.1.0, and use PhoneGap Build, to build the application.

16条回答
  •  失恋的感觉
    2020-12-09 16:08

    This worked perfectly for me on iOS.

    As mentioned in the link above:

    1- Install the plugin using the command:

    cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git 
    

    2- And in the HTML file, use one of the following as needed:

    window.open(‘http://example.com’, ‘_system’);   Loads in the system browser 
    window.open(‘http://example.com’, ‘_blank’);    Loads in the InAppBrowser
    window.open(‘http://example.com’, ‘_blank’, ‘location=no’); Loads in the InAppBrowser with no location bar
    window.open(‘http://example.com’, ‘_self’); Loads in the Cordova web view 
    

提交回复
热议问题