在cordova应用程序中包含外部JavaScript代码

时间:2018-05-20 10:44:45

标签: javascript android cordova ionic-framework phonegap

我尝试在我的cordova应用程序中包含外部JavaScript代码,但它不起作用。

我的代码如下:

<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script> 
<script type="text/javascript" src="http://website.com/api/scripts.js"></script>

我的白名单脚本如下:

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

1 个答案:

答案 0 :(得分:0)

最好从应用程序库加载jQuery脚本而不是外部(与Web不同),使加载速度更快。 关于脚本添加, <access origin="https://*.website.com/api/scripts.js" launch-external="yes"/>检查它是否修复了构建。

相关问题