Cordova 3.1在iOS6上的Safari中打开链接

Hug*_*ugo 6 iphone mobile-safari ios cordova

我正在使用Cordova 3.1构建iOS应用程序.我想在Safari中打开一个链接.我已经安装了org.apache.cordova.inappbrowser插件,它在我的iPhone(iOS 7)和模拟器(iOS5; iOS6.1; iOS7)上运行良好但是如果我在所有设备上尝试(iOS6)它没有'工作.

有人知道如何解决这个问题或在运行iOS6的真实设备上尝试过吗?我正在使用此代码打开链接:

window.open('http://www.google.nl', '_system');
Run Code Online (Sandbox Code Playgroud)

小智 3

好吧,我已经通过本机端实现了这一点(目标 C)

在“MainViewController.m”中添加此方法

- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSURL *url = [request URL];
    NSString *str = url.absoluteString;
    NSRange range = [str rangeOfString:@"http://"];
    NSRange range1 = [str rangeOfString:@"https://"];

    if (range.location != NSNotFound || range1.location != NSNotFound) {
        [[UIApplication sharedApplication] openURL:url];
        return NO;
    }
    else {
        return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
    }
}
Run Code Online (Sandbox Code Playgroud)

这会处理 iOS6 和 iOS7 的“http”和“https”链接,并在设备的默认浏览器中打开该链接。