objective c - Disable Cut/Copy in Webview -
ok, scenario simple:
- i have webview
- i want user not to able cut/copy webview, no matter (either ⌘c, or via edit menu)
i know have subclass webview, specific methods have override?
any ideas? (any other approach welcome!)
add following css file
html { -ms-touch-action: manipulation; touch-action: manipulation; } body { -webkit-user-select: none !important; -webkit-tap-highlight-color: rgba(0,0,0,0) !important; -webkit-touch-callout: none !important; }
and link css html
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="layouttemplates/css/style.css" type="text/css" /> </head> </html>
or programmatically disable
- (void)webviewdidfinishload:(uiwebview *)webview { [webview stringbyevaluatingjavascriptfromstring:@"document.documentelement.style.webkituserselect='none';"]; [webview stringbyevaluatingjavascriptfromstring:@"document.documentelement.style.webkittouchcallout='none';"]; }
Comments
Post a Comment