Thi*_*iff 17
如果您正在使用PhoneGap Build,请将其添加到您的config.xml文件中:
<preference name="stay-in-webview" value="true" />
Run Code Online (Sandbox Code Playgroud)
如果你没有使用Build,请在你的Cordova.plist/Phongap.plist:
OpenAllWhitelistURLsInWebView = 'Yes'
Run Code Online (Sandbox Code Playgroud)
我在这篇文章中找到了答案 http://craigpfau.com/2012/02/phonegap-ios-uiwebview-and-safari-app-links/
在 AppDelegate.m 中替换它
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest: (NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
if ([[url absoluteString] rangeOfString:@"URLToOpenInUIWebView.com"].location != NSNotFound) {
return YES;
}
else {
return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}
}
Run Code Online (Sandbox Code Playgroud)
您不想在 UIwebview 中打开的任何链接都可以使用 target="_blank"
| 归档时间: |
|
| 查看次数: |
5597 次 |
| 最近记录: |