Revision: 72173
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 26, 2017 04:40 by apphp-snippets
Initial Code
<script type="text/javascript"> function f1() { if(document.all) { return false; } } function f2(e) { if(document.layers || (document.getElementById && document.all)) { if(e.which==2 || e.which==3) { return false; } } } if(document.layers) { document.captureEvents(Event.MOUSEDOWN); document.onmousedown = f1; } else { document.onmouseup = f2; document.oncontextmenu = f1; } document.oncontextmenu = new function("return false"); </script>
Initial URL
http://www.apphp.com/index.php?snippet=javascript-blocking-right-click
Initial Description
This snippet code allows you to prevent the viewer from being able to right-click on your page. This can discourage the average user from borrow images or code from your site.
Initial Title
Blocking Right-Click in Browser with JavaScript
Initial Tags
Initial Language
JavaScript