Navigation Allow List
This controls which URLs the WebView itself can be navigated to. It applies only to top-level navigations.
控制哪些url可以在cordova WebView中直接访问。
Intent Allow List
This controls which URLs the app is allowed to ask the system to open.
控制哪些url可以交给系统打开。这个url请求是直接调用 [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]。如:
<allow-intent href="http:*" />,跳出当前cordova应用,调起系统默认浏览器打开url。
<allow-intent href="tel:*" />,系统调起打电话的请求。
<allow-intent href="iosamap:*" />,打开高德地图。
allow-navigation优先级更高
如同时设置<allow-navigation href="http:*" />和<allow-intent href="http:*" />,会在当前WebView中跳转到对应http url,不会调起系统浏览器打开url。
如果设置了<allow-navigation href="*" />,则所有请求都通过当前cordova WebView访问,allow-intent设置的系统跳转都会被allow-navigation拦截,而大多数allow-intent设置的第三方协议,如iosamap://(高德地图)在cordova WebView中是无法打开的。
所以尽量不要设置<allow-navigation href="*" /> !!
可以设置:
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
...
<allow-intent href="tel:*" />
<allow-intent href="iosamap:*" />
...
网友评论