Zach
Zach

Reputation: 442

Confirm UIWebView link click

I know that you can detect link clicks in a UIWebView with:

UIWebViewNavigationTypeLinkClicked

and easily access the url, i also know that you can:

return YES or return NO

if you want to advance to the next page or not...but is there a way to use a UIAlertView to determine if the use wants to return YES or NO?

Upvotes: 0

Views: 819

Answers (1)

rmaddy
rmaddy

Reputation: 318924

This can be done. When you get the link in the webView:shouldStartLoadWithRequest:navigationType: delegate method, save off the URL, display the alert view, then return NO from the delegate method.

If the user taps the YES button on your alert view, use the saved URL to load a new request in the web view.

Upvotes: 3

Related Questions