×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Spiro Bad
Added: Feb 26, 2017 12:51 PM
Views: 24
Deny user's right click on our page
  1. <script type="text/javascript">
  2. <!--
  3. function clickIE() {if (document.all) {(message);return false;}}
  4. function clickNS(e) {if
  5. (document.layers||(document.getElementById&&!document.all)) {
  6. if (e.which==2||e.which==3) {(message);return false;}}}
  7. if (document.layers)
  8. {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
  9. else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
  10. document.oncontextmenu=new Function("return false")
  11. // -->
  12. </script>
  13.  
  14. <script type="text/javascript">
  15. <!--
  16. function disableselect(e){
  17. return false
  18. }
  19. function reEnable(){
  20. return true
  21. }
  22. //if IE4+
  23. document.onselectstart=new Function ("return false")
  24. //if NS6
  25. if (window.sidebar){
  26. document.onmousedown=disableselect
  27. document.onclick=reEnable
  28. }
  29. // -->
  30. </script>