关于cordova应用程序的iframe问题

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

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

这是我的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个回答
1
投票

出于某种原因,在重新安装Whitelist插件并让其混淆之后,问题就解决了,现在youtube iframe还可以。在阅读了一些论坛和文章后,我相信问题的解决方案是配置文件中的这一行:

<allow-navigation href="https://*youtube.com/*"/>
© www.soinside.com 2019 - 2024. All rights reserved.