Windows cordova mac在safari中打开URL
我使用下面的内容制作mac os x应用程序,但似乎无法打开空白链接。如果有人知道那将是多么好 答案1)-不起作用 我把它放在WebViewDelegate.m中- UIWebViewNavigationType<是错误Windows cordova mac在safari中打开URL,windows,cordova,safari,hyperlink,Windows,Cordova,Safari,Hyperlink,我使用下面的内容制作mac os x应用程序,但似乎无法打开空白链接。如果有人知道那将是多么好 答案1)-不起作用 我把它放在WebViewDelegate.m中- UIWebViewNavigationType
我认为"空白改变"是最近才出现的,还没有在iOS中实现。我目前在
AppDelegate.m
中使用这段本机代码在Safari中打开外部URL
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
//return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
NSURL *url = [request URL];
// Intercept the external http requests and forward to Safari.app
// Otherwise forward to the PhoneGap WebView
if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"] || [[url scheme] isEqualToString:@"itms-apps"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
else {
return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}
}
此在2.3.0 oO上运行'
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType{
//return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
NSURL *url = [request URL];
// Intercept the external http requests and forward to Safari.app
// Otherwise forward to the PhoneGap WebView
if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"] || [[url scheme] isEqualToString:@"itms-apps"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
else {
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}}
嗯,我在Cordova应用程序中使用它,而不是在Cordova Mac组件中使用它。您可能需要调整代码,以便在组件而不是应用程序中使用。只需寻找等效的方法。
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType{
//return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
NSURL *url = [request URL];
// Intercept the external http requests and forward to Safari.app
// Otherwise forward to the PhoneGap WebView
if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"] || [[url scheme] isEqualToString:@"itms-apps"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
else {
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}}