Sometimes PhoneGap opens web pages in Safari, sometimes it opens them in its UIWebView, what controls this?
Asked
Active
Viewed 1,811 times
1 Answers
4
From Does phoneGap support normal web?:
https://github.com/callback/callback-ios/blob/master/PhoneGapLib/Classes/PhoneGapDelegate.m#L669 reveals that:
- if the URL has scheme gap:// it does not open Safari
- if the URL has scheme file:// it does not open Safari
- if the OpenAllWhitelistURLsInWebView policy is set it does not open Safari.
- if
navigationType == UIWebViewNavigationTypeOther && mainDocument != nil
then it does open Safari.
Elaborating on 4:
- ~NavTypeOther signifies that the navigation is not from: a link click, back/fwd button, reload, or form re/submission. (AKA
window.location.href assignment
, orwindow.open(...)
) mainDocument != nil
signifies that the link is not from an iFrame? and/or doesn't have a target?
So basically, I think that only link clicks open in the UIWebView (unless they're gap:// or file:// links, or that policy is set.)