使用 phonegap 在 xcode 4.1 上的 iframe 中允许外部主机
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7489104/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Allow external hosts in iframe on xcode 4.1 using phonegap
提问by vesters
I'm trying to create an iPad/iPhone-app that displays an iFrame that links to an external site. (It's doesn't have to be in the App Store).
我正在尝试创建一个 iPad/iPhone 应用程序,该应用程序显示一个链接到外部站点的 iFrame。(它不必在 App Store 中)。
The problem is that when I load the app, it's takes me to Safari.
问题是当我加载应用程序时,它会将我带到 Safari。
I know there was a setting in an earlier version of XCode, where you could specify which external hosts was allowed in the app. And that worked!
我知道早期版本的 XCode 中有一个设置,您可以在其中指定应用程序中允许使用哪些外部主机。那奏效了!
I can't seem to find the setting in 4.1...
我似乎无法在 4.1 中找到设置...
Anybody know where I can locate it?
有谁知道我在哪里可以找到它?
Cheers!
干杯!
回答by RayofHope
Changes to PhoneGap.plist or Cordova.plist
对 PhoneGap.plist 或 Cordova.plist 的更改
Change/add the following values in PhoneGap.plist or Cordova.plist file of your app.
在您的应用程序的 PhoneGap.plist 或 Cordova.plist 文件中更改/添加以下值。
MediaPlaybackRequiresUserAction: NO
MediaPlaybackRequiresUserAction:否
AllowInlineMediaPlayback: YES
允许内联媒体播放:是
OpenAllWhitelistURLsInWebView: YES
OpenAllWhitelistURLsInWebView: 是
and set ExternalHosts list as you require
并根据需要设置 ExternalHosts 列表
here i do for showing gopoglemap in app
我这样做是为了在应用程序中显示 gopoglemap
ExternalHosts
外部主机
*.google.com
*.gstatic.com
回答by roman
Phonegap reads a setting called 'ExternalHosts' - this one is used to whitelist allowed external domains.
Phonegap 读取名为“ExternalHosts”的设置 - 该设置用于将允许的外部域列入白名单。
Open phonegap.plist - the key should be there, if not, simply add it.
打开 phonegap.plist - 密钥应该在那里,如果没有,只需添加它。