简体   繁体   中英

PhoneGap (iPhone / Xcode 4) All links open in Safari

I installed PhoneGap in Xcode but every link I place in the HTML open in Safari, is there a way to get around this? (Even window.location = ''; opens safari)

Also does anyone know how you can start with a remote address instead of a local?

Late response, but here's what I found out if anyone stumbles across this that doesn't require using the ChildBrowser plugin mentioned earlier.

Cordova.plist (found in the Supporting Files folder) has some settings for determining this behavior:

  • The URLs need to be added to " ExternalHosts " in order for them to be whitelisted (add as many as needed & you can use * as a wildcard).
  • Set " OpenAllWhitelistURLsInWebView " to YES .

There might be other settings worth configuring there as well, but those two should prevent links & window.location from opening via Mobile Safari.

I've never used it, but often see others referencing the ChildBrowser plugin , which looks like it may fit your needs. You can check out the readme.txt for more info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM