I am loading some content from the web into a UIWebView
, but I'd like all links to be disabled in the UIWebView
. Is this possible? I could parse the text, but I'm looking for something easier.
You can give the UIWebView
a delegate and implement the -webView:shouldStartLoadWithRequest:navigationType:
delegate method to return NO;
(except on the initial load).
That will prevent the user from viewing anything but that single page.
To provide an example requested in the comments... Start with allowLoad=YES
and then:
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
return allowLoad;
}
- (void)webViewDidFinishLoad:(UIWebView*)webView {
allowLoad = NO;
}
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