You can get your "webview" attribute using JavaScript, and after that you can send this attribute and its value to Objective-C native code.
Add this JavaScript code to the HTML page inside the script tag:
function reportBackToObjectiveC(string) { var iframe = document.createElement("iframe"); iframe.setAttribute("src", "callback://" + string); document.documentElement.appendChild(iframe); iframe.parentNode.removeChild(iframe); iframe = null; } var links = document.getElementsByTagName("a"); for (var i=0; i<links.length; i++) { links[i].addEventListener("click", function() { var attributeValue=links[i].webview;
after that, your webViewDelegate method will call:
- (BOOL)webView:(UIWebView *)wView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ { if (navigationType == UIWebViewNavigationTypeLinkClicked) { NSURL *URL = [request URL]; if ([[URL scheme] isEqualToString:@"callback"]) {
source share