gpt4 book ai didi

ios5 - Cordova (PhoneGap) 和 iFrame

转载 作者:行者123 更新时间:2023-12-01 00:06:48 26 4
gpt4 key购买 nike

似乎每个人都知道 PhoneGap 中不允许在您的应用程序中使用 iFrame 的愚蠢行为。那里有许多修复程序,但它们要么适用于 PhoneGap 的旧版本,要么不起作用,要么导致其他问题。到目前为止,这是我尝试过的:

  1. OpenAllWhitelistURLsInWebView

  2. http://craigpfau.com/2012/02/phonegap-ios-uiwebview-and-safari-app-links/

  3. How can I open an external link in Safari not the app's UIWebView?

似乎没有任何效果。这是我要实现的目标:

  1. 来自 vimeo (iframe) 的视频嵌入保留在应用程序中,外部主机:vimeo.com a.vimeocdn.com b.vimeocdn.com
  2. 所有其他链接都指向 safari

这是我的应用详情:

iOS 5.1.1 | Cordova 1.7.0 |移动端 |查询 1.7.1

最佳答案

我有一个示例应用程序 here它确实会在应用程序内打开 Vimeo 视频,但会在 Safari 中打开其他网址。

我在 MainViewController.m 中更改了以下函数

- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
NSString *host = [request.URL host];

if(host != NULL || host != nil){
if ([host rangeOfString:@"vimeo.co"].location != NSNotFound) {
return YES;
}else{
if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
else {
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}
}
}

return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}

关于ios5 - Cordova (PhoneGap) 和 iFrame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11035059/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com