Block copy of texts, images, drag, right button, CRTL keys (ONLY WITH CSS)

0

I am currently using this code, which protects text selection, and selecting and dragging images:

    <style>
/*desabilita a seleção no body*/
body {
    -webkit-touch-callout: none; /* iOS Safari */
      -webkit-user-select: none; /* Chrome/Safari/Opera */
       -khtml-user-select: none; /* Konqueror */
         -moz-user-select: none; /* Firefox */
          -ms-user-select: none; /* Internet Explorer/Edge */
              user-select: none;
}

/*habilita a seleção nos campos editaveis*/
input, textarea {
    -webkit-touch-callout: initial; /* iOS Safari */
      -webkit-user-select: text; /* Chrome/Safari/Opera */
       -khtml-user-select: text; /* Konqueror */
         -moz-user-select: text; /* Firefox */
          -ms-user-select: text; /* Internet Explorer/Edge */
              user-select: text;
}

/*habilita a seleção nos campos com o atributo contenteditable*/
[contenteditable=true] {
    -webkit-touch-callout: initial; /* iOS Safari */
      -webkit-user-select: all; /* Chrome/Safari/Opera */
       -khtml-user-select: all; /* Konqueror */
         -moz-user-select: all; /* Firefox */
          -ms-user-select: all; /* Internet Explorer/Edge */
              user-select: all;
}


/*Desabilitar download e arrastar imagem*/
img {
    pointer-events: none;
}

</style>

I just need the function makes blocking the functions with CSS: right-click, lock the CTRL key to prevent CTRL + CTRL + C commands among other commands via CTRL     

asked by anonymous 24.03.2018 / 19:08

1 answer

0

CSS can not do this kind of thing, but with JavaScript you can do this:

function disable(x,e) {
    if(e.ctrlKey) {
       return false;
    }
    
    return true;
}
#div { 
  height:200px; border:1px solid red;
  width; 200px;
 }
<div oncontextmenu="return false;" id="div" onKeyDown="return disable(this,event);" contentEditable="true">
</div>
    
24.03.2018 / 19:16