$ cordovaInAppBrowser打开网址显示地址栏很奇怪

问题描述 投票:0回答:2

当我点击网址使用$cordovaInAppBrowser.open(url, '_blank', options)打开网址时,它会在我打开InAppBrowser时将其退回到网址,它显示出奇怪的行为。

这是我的代码

    var options = {
        location: 'yes',
        clearcache: 'yes',
        toolbar: 'no'
    };
    $cordovaInAppBrowser.open(url, '_blank', options)
    .then(function (event) {
        // success
    })
    .catch(function (event) {
        // error
    });

enter image description here

cordova ionic-framework cordova-plugins inappbrowser
2个回答
1
投票

您可以尝试以下选项。

iOS:

cordova.InAppBrowser.open(yourURL, '_blank', 'toolbar=no');

Android:

cordova.InAppBrowser.open(yourURL, '_blank', 'location=no');

在你的情况下cordova.InAppBrowser$cordovaInAppBrowser


0
投票

我能够使用Android和ios的代码解决它

  self.viewLink = function (viewUrl) {

        var url = (viewUrl.match('http')) ? viewUrl : 'http://' + viewUrl;
        var options = {
            location: 'no',
            clearcache: 'yes',
            toolbar: 'yes',
            closebuttoncaption: 'Done'
        };
        $cordovaInAppBrowser.open(url, '_blank', options)
        .then(function (event) {
            // success
        })
        .catch(function (event) {
            // error
        });
        return false;
    }

对我来说它完美无缺。希望如此,对某些人来说,它会起作用。

© www.soinside.com 2019 - 2024. All rights reserved.