I have an app with a UIWebView
inside a UIViewController
. I load HTML from a web service as a string like this:
self.webView loadHTMLString:_string baseURL:nil
Is it possible for the HTML links in this string to be opened in the browser and not in the UIWebView in my app? How can I do this?
I have tried this in the UIViewController that "hosts" the UIWebVIew:
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if (navigationType == UIWebViewNavigationTypeLinkClicked) { [[UIApplication sharedApplication] openURL:[request URL]]; return NO; } return YES; }
It doesn't seem to be working....
Any ideas?
Uses Nitro, a faster JavaScript engineWKWebView uses the Nitro JavaScript engine, also used by mobile Safari, which comes with significant performance improvements over UIWebView's older JavaScript engine.
It means that your web site was viewed using the UIWebView functionality on an iOS device (iPhone, iPad, iPod Touch). The UIWebView is different from the ordinary Safari browser, as it is not a stand-alone browser, but merely browser functionality that is embedded in a third party app.
Cookies do appear to be shared between Safari and WebViews.
Have you set the delegate of the UIWebView
to your UIViewController
? There's nothing obviously wrong with your code as far as I can see, so it's likely to be something small like that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With