You can do this using your own protocol. In your html file you can refer to something like myProtocol://callSomeAction.
Then on your UIWebViewDelegate(possibly yours UIViewController) you should implement a method called:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
(Docs )
, request. myProtocol, IBAction NO. - , - YES.
:
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSString* scheme = [[request URL] scheme];
if ([@"myProtocol" isEqual:scheme]) {
return NO;
} else {
return YES;
}
}