There is a way to do this, but it is not very.
UIWebView allows you to run arbitrary javascript, for example. [webview stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('html')[0].innerHTML"] . That way, when the user clicks on the video element, you can run javascript, which sets the innerHTML of a particular element, which you can extract from this function.
However, how do you know when to run this function on the Objective-C side? Well, there are two options. At first (although I would not suggest it, since it would be slow), you can set up a polling function that runs so often to check the value of the stringByEvaluatingJavascriptFromString: function. The second option, which, in my opinion, is perhaps the best, is to actually subclass WebView to track the touches of WebView. Thus, you can override the following function:
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; NSString *string = [self stringByEvaluatingJavascriptFromString:@"document.getElementById('videoTapped').innerHTML"] if ([string isEqual:@"Something"]) {
Jason source share