1. access
定義app可交互的domain,默承認與任何domain交互
適用於 main Cordova webview, 不適用於 InAppBrowser webview
或打開系統瀏覽器
舉例:web
Access to google.com:apache
<access origin="http://google.com" />
Access to the secure google.com(https://
):瀏覽器
<access origin="https://google.com" />
Access to the subdomain maps.google.com:app
<access origin="http://maps.google.com" />
Access to all the subdomains on google.com, for example mail.google.comand docs.google.com:dom
<access origin="http://*.google.com" />
Access to_all_domains, for example, google.comand developer.mozilla.org:google
<access origin="*" />
2. allow-navigation
控制WebView能跳轉的URL,在最頂層生效插件
<!-- 容許跳轉 example.com --> <allow-navigation href="http://example.com/*" /> <!-- 路徑前綴後綴能夠使用通配符 --> <allow-navigation href="*://*.example.com/*" /> <!-- 通配符配置可訪問全網不管http仍是https *不推薦*--> <allow-navigation href="*" /> <!-- 上述三個最終等同如下配置 --> <allow-navigation href="http://*/*" /> <allow-navigation href="https://*/*" /> <allow-navigation href="data:*" />
3. allow-intent
控制App可以讓系統打開的網址(默認不容許打開任何網址)code
<!-- 容許任何網址在瀏覽器打開 --> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <!-- 容許example.com在瀏覽器打開 --> <allow-intent href="http://example.com/*" /> <!-- 先後綴可通配符配置 --> <allow-intent href="*://*.example.com/*" /> <!-- 容許短信連接打開app --> <allow-intent href="sms:*" /> <!-- 容許打開通話 --> <allow-intent href="tel:*" /> <!--容許打開地圖--> <allow-intent href="geo:*" /> <!-- 容許全部未識別網址打開所下載的app*不推薦* --> <allow-intent href="*" />
白名單不適用插件內打開連接,只適用於超連接打開window.open()
.xml
參考白名單Cordova官網cordova