Disable links in UIWebView?

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.

Answers


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;
}

Need Your Help

Modify Django “save and add another” button to set initial value of field based on value of field on object just saved

django forms django-forms django-admin

I have a basic blog app with models Entry and Category. One of the fields in Entry is a ForeignKey to Category. When a user is adding an Entry and chooses to "save and add another', I'd like it i...

Pandas time series resample

python datetime pandas time-series

I have a data frame with a datetime stamp column and a value column

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.