IOS webview 禁用选择和电话的处理

2019-04-04  本文已影响0人  刃之剑

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">

仅做笔记 ~

上一篇下一篇

猜你喜欢

热点阅读