在UIWebView中禁用复制和粘贴 [英] Disable copy and paste in UIWebView
本文介绍了在UIWebView中禁用复制和粘贴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
差不多,我曾尝试在 UIWebView
中禁用复制/粘贴,但没有任何方法可以解决。
Nearly, I had tried every thing to disable copy/paste in UIWebView
but nothing worked with me.
我从字符串(字符串数组)加载我的 UIWebView
,如下所示:
I'm loading my UIWebView
from a string (array of strings) as follows:
[webView loadHTMLString:
[NSString stringWithFormat:@"%@<p class=\"paragraph\" style=\"float: right\" >%@</p>",css,[[array objectAtIndex:0] valueForKey:@"content"]] baseURL:nil ];
我试过这个:
-(void)webViewDidFinishLoad:(UIWebView *)webView1{
[webView1 stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitUserSelect='none';"];
}
这个:
NSString *css =
@"<head><style><body> *{-webkit-touch-callout: none; -webkit-user-select: none;}</style> </head> </body> ";
但是没有任何效果我
特别适用于iOS 4.2
but nothing worked with me especially for iOS 4.2
推荐答案
-webkit-user-select: none; /* Disable selection/Copy of UIWebView */
还将禁用Mobile Safari上的表单。
will also disable form on Mobile Safari.
这篇关于在UIWebView中禁用复制和粘贴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文