IOS webview 禁用选择和电话的处理
1.webview 禁用选择和用户交互让人从视觉看起来不是web页面
-(void)webViewDidFinishLoad:(UIWebView*)webView{
[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitUserSelect='none';"];
[webViewstringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitScrollow='none';"];
[webViewstringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTouchCallout='none';"];
}
2.web默认会把一串数字作为电话号请求拨打,可以在
-(void)webViewDidFinishLoad:(UIWebView*)webView{ [webViewstringByEvaluatingJavaScriptFromString:@"var meta = document.createElement('meta');meta.content='telephone=no';meta.name='format-detection';document.getElementsByTagName('head')[0].appendChild(meta);"];
}
或者在web那边添加
<meta name = "format-detection" content = "telephone=no">
仅做笔记 ~