User Tools

Site Tools


web_sites:disable_right-clicking_by_using_javascript

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
web_sites:disable_right-clicking_by_using_javascript [2020/05/05 23:48] peterweb_sites:disable_right-clicking_by_using_javascript [2020/07/15 10:30] (current) – external edit 127.0.0.1
Line 16: Line 16:
   document.addEventListener("keydown", function(e) {   document.addEventListener("keydown", function(e) {
   //document.onkeydown = function(e) {   //document.onkeydown = function(e) {
 +    // CTRL + A
 +    if (e.ctrlKey && e.keyCode == 65) {
 +      disabledEvent(e);
 +    }
 +    // CTRL + C
 +    if (e.ctrlKey && e.keyCode == 67) {
 +      disabledEvent(e);
 +    }  
 +    // "C" key
 +    if (e.ctrlKey && e.shiftKey && e.keyCode == 67) {
 +      disabledEvent(e);
 +    }
     // "I" key     // "I" key
     if (e.ctrlKey && e.shiftKey && e.keyCode == 73) {     if (e.ctrlKey && e.shiftKey && e.keyCode == 73) {
Line 50: Line 62:
 </code> </code>
  
-This code will block the right click of mouse, Ctrl + Shift + I, Ctrl+ Shift + J, Ctrl + S, Ctrl + U, and F12 key.+This code will block the right click of mouse, Ctrl+A, Ctrl+C, Ctrl+Shift+C, Ctrl+Shift+I, Ctrl+Shift+J, Ctrl+S, Ctrl+U, and F12 key.
  
 The F12 key uses for looking the source code of page, so it also need be disabled. The F12 key uses for looking the source code of page, so it also need be disabled.
web_sites/disable_right-clicking_by_using_javascript.1588718936.txt.gz · Last modified: 2020/07/15 10:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki