Opening links in external device browser with Cordova/jQuery-mobile

后端 未结 5 1546
故里飘歌
故里飘歌 2021-01-17 23:09

I have a bunch of links in my app. I added rel=\'external\' target=\'_blank\' to all of them.

In the Ripple emulator, or in a regular desktop browser,

5条回答
  •  臣服心动
    2021-01-17 23:35

    There're a few questions like this, but all of them try to use inappbrowser. I've used the following plugin:

    com.byhook.cordova.chromelauncher
    

    Just install it, as always, through cli:

    cordova plugin add com.byhook.cordova.chromelauncher
    

    And add the following JavaScript code:

    ChromeLauncher.open(url)
    

    This will:

    1. put your app in background mode
    2. open the existing instance of "google chrome for android" browser (according to the code, Google Play is gonna be opened if Chrome browser is not found, but i haven't tested this)
    3. add a new tab to Chrome browser pointing to the desired URL

提交回复
热议问题