1.可以直接执行JS , 这样的话要等载入完成后再执行
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{ [self.webView evaluateJavaScript:@"document.documentElement.style.webkitTouchCallout='none';" completionHandler:nil]; [self.webView evaluateJavaScript:@"document.documentElement.style.webkitUserSelect='none';"completionHandler:nil];}
2.
原来苹果会在html中对herf关键字 做优化,即使你href="#" 或 href="void(0)" 都会触发对话框
所以,两种解决方案
1> 在html标签里 彻底删除href=xx
2> 如果你业务逻辑需要的话,不妨加个标签代替href
a .originalLink { color: blue; text-decoration: underline; cursor: pointer; }<a class="originalLink" οnclick="location.href='http://mylink';">Real URL Link</a>
君凯商联网-iOS-字唐名僧