$cordova InAppBrowser 打开 url 显示地址栏很奇怪

$cordovaInAppBrowser open url showing address bar weird

当我单击 url 以使用 $cordovaInAppBrowser.open(url, '_blank', options) 打开 url 时,它让我退休 url 当它打开 InAppBrowser 时,它显示出奇怪的行为。

这是我的代码

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

您可以尝试以下选项。

iOS :

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

Android :

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

在你的例子中 cordova.InAppBrowser$cordovaInAppBrowser.

我可以使用此代码解决 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;
    }

对我来说,它工作得很好。希望对某些人有用。