phonegap / callback / cordova在所有平台上都有白名单吗?它是否以相同的方式实现?
答案 0 :(得分:16)
白名单同时存在于iOS和Android上,但尚未出现在其他平台上。
在 iOS 下,它名为“外部主机”,在此处说明:http://wiki.phonegap.com/w/page/41631150/PhoneGap%20for%20iOS%20FAQ
Q. Links to and imported files from external hosts don't load?
A. 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).
例如:
<key>ExternalHosts</key>
<array>
<string>*</string>
</array>
对于 Android ,该功能目前尚未记录,并且有些错误,虽然正在修复。该主题包含一些很好的故障排除细节:https://groups.google.com/forum/#!topic/phonegap/9NZ4J4l1I-s
简而言之,它是xml / phonegap.xml中的'access'属性。它使用perl风格的正则表达式
To allow all domains (debugging): <access origin=".*"/>
很快,这可能会改为以下语法:
<access origin="https://example.com" subdomains="true" />
BlackBerry 上的白名单是作为WebWorks框架的一部分提供的
并通过config.xml配置:
https://bdsc.webapps.blackberry.com/html5/documentation/ww_developing/access_element_834677_11.html
示例项目允许通过“*”外卡访问所有URL。