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