Navigation Allow List
This controls which URLs the WebView itself can be navigated to. It applies only to top-level navigations.
控制哪些url可以在cordova WebView中直接訪問(wèn)。
Intent Allow List
This controls which URLs the app is allowed to ask the system to open.
控制哪些url可以交給系統(tǒng)打開(kāi)。這個(gè)url請(qǐng)求是直接調(diào)用 [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]。如:
<allow-intent href="http:*" />,跳出當(dāng)前cordova應(yīng)用,調(diào)起系統(tǒng)默認(rèn)瀏覽器打開(kāi)url。
<allow-intent href="tel:*" />,系統(tǒng)調(diào)起打電話的請(qǐng)求。
<allow-intent href="iosamap:*" />,打開(kāi)高德地圖。
allow-navigation優(yōu)先級(jí)更高
如同時(shí)設(shè)置<allow-navigation href="http:*" />和<allow-intent href="http:*" />,會(huì)在當(dāng)前WebView中跳轉(zhuǎn)到對(duì)應(yīng)http url,不會(huì)調(diào)起系統(tǒng)瀏覽器打開(kāi)url。
如果設(shè)置了<allow-navigation href="*" />,則所有請(qǐng)求都通過(guò)當(dāng)前cordova WebView訪問(wèn),allow-intent設(shè)置的系統(tǒng)跳轉(zhuǎn)都會(huì)被allow-navigation攔截,而大多數(shù)allow-intent設(shè)置的第三方協(xié)議,如iosamap://(高德地圖)在cordova WebView中是無(wú)法打開(kāi)的。
所以盡量不要設(shè)置<allow-navigation href="*" /> ??!
可以設(shè)置:
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
...
<allow-intent href="tel:*" />
<allow-intent href="iosamap:*" />
...