1

Sometimes PhoneGap opens web pages in Safari, sometimes it opens them in its UIWebView, what controls this?

nmr
  • 16,625
  • 10
  • 53
  • 67

1 Answers1

4

From Does phoneGap support normal web?:

https://github.com/callback/callback-ios/blob/master/PhoneGapLib/Classes/PhoneGapDelegate.m#L669 reveals that:

  1. if the URL has scheme gap:// it does not open Safari
  2. if the URL has scheme file:// it does not open Safari
  3. if the OpenAllWhitelistURLsInWebView policy is set it does not open Safari.
  4. 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, or window.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.)

Community
  • 1
  • 1
nmr
  • 16,625
  • 10
  • 53
  • 67