Yes you can do it. Implement
โ webView:shouldStartLoadWithRequest:navigationType:
This delegate . This method is called every time your webview is about to make a request. So now, when someone clicks a button or hyperlink on your web page, you will receive a call to this method. Once you catch this challenge, you can do whatever you want. How to redirect a link through your own servers or register a request to your server about user activity or in your case display a comment page or change the navigation bar, etc.
Example. Here you are trying to intercept any links clicked on your web page and pass them through myMethodAction
.
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { if(navigationType == UIWebViewNavigationTypeLinkClicked) { if(overrideLinksSwitch.on == TRUE) { [self myMethodAction]; [myWebView stopLoading]; return YES; } else { return YES; } } return YES; }
Hope this helps ...
source share