2012-01-17 66 views

Trả lời

16

Danh sách trắng hiện có trên cả iOS và Android, nhưng chưa có trên các nền tảng khác.

Dưới iOS, nó đi dưới cái tên "Hosts ngoài", được giải thích ở đây: 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). 

Ví dụ:

<key>ExternalHosts</key> 
<array> 
    <string>*</string> 
</array> 


Đối Android, tính năng hiện không được cấp phép và hơi lỗi, mặc dù đang sửa lỗi. Chủ đề này chứa một số chi tiết khắc phục sự cố tốt: https://groups.google.com/forum/#!topic/phonegap/9NZ4J4l1I-s

Tóm lại, đó là thuộc tính 'truy cập' trong xml/phonegap.xml. Nó sử dụng perl kiểu regex

To allow all domains (debugging): <access origin=".*"/> 

Ngay sau đó, điều này có thể thay đổi cú pháp sau:

<access origin="https://example.com" subdomains="true" /> 


Whitelist trên BlackBerry được cung cấp như một phần của WebWorks khuôn khổ và được cấu hình qua config.xml:

https://bdsc.webapps.blackberry.com/html5/documentation/ww_developing/access_element_834677_11.html

Dự án mẫu cho phép truy cập tất cả URL thông qua thẻ hoang dã "*".

Các vấn đề liên quan