【发布时间】:2017-01-17 15:39:08
【问题描述】:
我使用 PhoneGap 制作了一个应用程序(所以我使用 HTML、JavaScript 和 CSS 编写),在这个应用程序中我编写了多个“href”函数,例如:
<a href="mailto:marcel.loman@apt-alu-products.com">
marcel.loman@apt-alu-products.com </a><br />
Website: <a href="http://www.apt-alu-products.com">www.apt-alu-products.com</a></p>
我在所有 HTML 文档的“head”部分添加了一些“Content-security-policy”行,以确保如果我在 android 上运行 apk,它会起作用。这个 CSP 看起来像这样:
<meta http-equiv="Content-Security-Policy"
content="default-src *;
style-src * 'self' 'unsafe-inline' 'unsafe-eval';
script-src * 'self' 'unsafe-inline' 'unsafe-eval';">
除此之外,我还在 config.xml 文件的“小部件”部分之间添加了以下几行:
<allow-intent href="http://*/" />
<allow-intent href="https://*/*" />
<allow-intent href="mailto:*" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
(我知道出于安全原因不推荐使用这些线路,但这是我最后的手段) 尽管有这些行,但当我用它构建一个 APK 并在我的 Android 手机上运行它时,这些链接仍然不起作用。
互联网上有很多关于这个主题的文章,但我读过的文章都没有解决我的问题。
【问题讨论】:
标签: android html cordova phonegap-build content-security-policy