【问题标题】:$cordovaInAppBrowser open url showing address bar weird$cordovaInAppBrowser 打开 url 显示地址栏奇怪
【发布时间】:2018-05-21 14:17:23
【问题描述】:

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

这是我的代码

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

【问题讨论】:

    标签: cordova ionic-framework cordova-plugins inappbrowser


    【解决方案1】:

    您可以尝试以下选项。

    iOS:

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

    安卓:

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

    在你的情况下 cordova.InAppBrowser$cordovaInAppBrowser

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-07-28
        • 2015-04-23
        • 1970-01-01
        • 2022-08-18
        • 1970-01-01
        • 2018-06-01
        • 1970-01-01
        相关资源
        最近更新 更多