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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -