【问题标题】:04-28 16:06:29.756: W/SystemWebViewClient(16778): URL blocked by whitelist:04-28 16:06:29.756: W/SystemWebViewClient(16778): URL 被白名单阻止:
【发布时间】:2015-07-06 23:25:50
【问题描述】:

我更新ionic和cordova时出现这个问题,$http不能正常工作了,总是返回null。在调试行中出现“04-28 16:06:29.756: W/SystemWebViewClient(16778): URL 被白名单阻止:”

【问题讨论】:

    标签: cordova ionic whitelist blocked


    【解决方案1】:

    使用更新版本的cordova-android,您现在需要包含cordova-whitelist-plugin。

    https://github.com/apache/cordova-mobile-spec/tree/master/cordova-plugin-whitelist

    尝试将其添加到您的项目中

    例如——

          cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git
    

    如需更多帮助,请阅读https://github.com/driftyco/ionic/issues/3597 上的问题

    【讨论】:

      【解决方案2】:

      此错误发生在 cordova 更新 5.0.0 之后。

      就像 Santosh 所说,您只需将插件 https://github.com/apache/cordova-plugin-whitelist.git 添加到您的应用程序中,一切都会正常运行。我遇到了同样的错误,我用这个插件修复了。

      您需要将以下代码添加到您的 webconfig 文件中:

      <allow-navigation href="http://yourDomain.com/*" />
      

      【讨论】:

        【解决方案3】:

        将此命令与新的 CLI 一起使用:

        ionic cordova plugin add cordova-plugin-whitelist
        

        并且在config.xml 中无需更改默认设置:

        <allow-intent href="http://*/*" />
        <allow-intent href="https://*/*" />
        <allow-intent href="tel:*" />
        <allow-intent href="sms:*" />
        <allow-intent href="mailto:*" />
        <allow-intent href="geo:*" />
        

        这里 * 代表任何东西,所以我使用这些设置解决了我的 CORS 问题。

        注意:添加插件后不要忘记删除平台,虽然它也是自动添加的,但最好采取预防措施,因为您永远不知道可能是什么原因使用

        ionic cordova plugin save
        ionic cordova platform remove android
        ionic cordova platform remove ios
        

        然后再添加一次

        ionic cordova platform add android
        ionic cordova platform add ios
        

        【讨论】:

          【解决方案4】:

          我遇到了同样的问题,请尝试再次添加白名单插件。因为它可能会像我们一样丢失。所以试试下面的命令

          对于 phonegap 构建:

          phonegap plugin add cordova-plugin-whitelist
          

          对于科尔多瓦:

          cordova plugin add cordova-plugin-whitelist
          

          【讨论】:

            猜你喜欢
            • 2021-11-02
            • 1970-01-01
            • 2015-03-03
            • 2021-06-28
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2017-03-24
            • 2022-01-11
            相关资源
            最近更新 更多