iPhone上的PhoneGap不会加载外部脚本 [英] PhoneGap on iPhone wont load external scripts

查看:64
本文介绍了iPhone上的PhoneGap不会加载外部脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用PhoneGap(iOS)编写一个简单的应用程序并在模拟器中运行它。问题是外部URL似乎拒绝加载。例如,使用CDN for jQuery

I am currently writing a simple application using PhoneGap (iOS) and running it in the simulator. The problem is that external URLs seem to refuse to load. For example using a CDN for jQuery

<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-1.7.min.js"></script>

不会使 $ / jQuery 可用。在尝试使用它时,weinre也会出现同样的问题。是否需要更改以使其能够正常工作?

Will not make $/jQuery available. The same problem is happening for weinre when trying to use it. Is there something I need to change to enable this to work?

推荐答案

您是否已将外部链接的域添加到ExternalHosts在PhoneGap.plist中输入?

Have you added the domains of the external links to the ExternalHosts entry in PhoneGap.plist ?

PhoneGap中有一个相当新的白名单系统导致与外部链接有点混淆

There is a fairly new whitelisting system in PhoneGap that is causing a bit of confusion with external links

来自 - http://wiki.phonegap.com/

此外,最新代码具有新的白名单功能。如果您引用外部主机,则必须在ExternalHosts键下的PhoneGap.plist中添加主机。通配符是好的。所以如果你要连接到 http://phonegap.com ,你必须添加phonegap.com到列表(或使用通配符* .phonegap.com,它也将匹配子域名。)

"Also, the latest code has the new white-list feature. If you are referencing external hosts, you will have to add the host in PhoneGap.plist under the "ExternalHosts" key. Wildcards are ok. So if you are connecting to "http://phonegap.com", you have to add "phonegap.com" to the list (or use the wildcard "*.phonegap.com" which will match subdomains as well)."

这篇关于iPhone上的PhoneGap不会加载外部脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆