cordova-plugin-inappbrowser not opening links from

2019-08-20 11:49发布

Search a lot, but not able to find the correct solution.

I am trying to open links from my app to default browser of my IOS device, 

but its not working. Its perfectly working with my android device.

  • My plugin is installed properly, ( i can see that in cordova plugin list on my app)

    followed are the syntaxes, which i have tried:

    window.open(this.href, '_system');

    window.open(this.href, '_blank', {closebuttoncaption: 'Close', toolbar: 'yes', 'location=yes'});

    window.open(this.href, '_blank', {closebuttoncaption: 'Close', toolbar: 'yes'});

    window.open(this.href, '_system', 'location=yes')

    same solution with cordova.InAppBrowser.open, this as starting syntax.

    along with that tried with controller function also

    link

    $scope.openInExternalBrowser = function (path) {

    var options = "closebuttoncaption=Close,toolbar=yes"; if($ionicPlatform.is('ios') == true){

    window.open(path, '_blank', {'closebuttoncaption': 'Close', 'toolbar':'yes', 'location=yes'});
    

    }else{ window.open(path, '_system', 'location=yes'); } }

So looking for some proper solution, which will work.

Thanks & Regards,

Sopo

2条回答
一纸荒年 Trace。
2楼-- · 2019-08-20 12:30

I simply use this for my project and confirm it's work

cordova.InAppBrowser.open('https://google.com','_self')
查看更多
太酷不给撩
3楼-- · 2019-08-20 12:41

Finally, after lot of research and thousand of builds, this post helped me to solve the issue.

Reference link

with the help of "cordova-plugin-whitelist" plugin. You need to add "gap:" after default-src attribute, your CSP meta. => default-src gap: *;

Thanks StackOverflow.

查看更多
登录 后发表回答