【问题标题】:Problems with iframes on cordova apps科尔多瓦应用程序上的 iframe 问题
【发布时间】:2019-03-05 02:53:19
【问题描述】:

我正在使用 cordova 开发一个应用程序,无论如何,每当我在 Android 上运行该应用程序时,youtube iframe 都不会加载。我已经尝试了我在这里和其他网站上看到的几件事,例如更改白名单、向元标记“Content-Security-Policy”添加参数、更改配置文件......对我来说没有任何效果.我对这个问题有点沮丧。我知道这个问题与科尔多瓦不让其他网站出于安全目的在应用程序上显示数据有关,但我不知道如何使它工作。如果有人可以帮助我解决这个问题,我将非常感激。

这是我的 Content-Security-Policy 元标记:

<meta http-equiv="Content-Security-Policy" script-src='unsafe-inline'>

这是我的配置文件

    <content src="index.html" />
<access origin="*" />
<allow-navigation href="https://*youtube.com/*"/>
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-browsersync" spec="^1.1.0" />

配置文件有默认行,但正如我之前所说,我已经尝试了我创建的所有内容。帮助!

【问题讨论】:

    标签: cordova iframe phonegap whitelist


    【解决方案1】:

    由于某种原因,在重新安装白名单插件并让配置保持原样后,问题得到了解决,现在 youtube iframe 可以了。在阅读了一些论坛和文章后,我认为问题的解决方案是配置文件中的这一行:

    <allow-navigation href="https://*youtube.com/*"/>
    

    【讨论】:

      猜你喜欢
      • 2017-06-08
      • 1970-01-01
      • 2017-06-20
      • 1970-01-01
      • 2015-04-26
      • 2016-06-02
      • 2014-12-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多