Tuesday 18 December 2012



No right-click scripts will keep some people from being able to steal your text and graphics. There are easy ways around it, but it may stop some newbies. Since newbies are often the ones most likely to steal your stuff because they don't know any better, you'll might stop some content theft with this simple trick.

<script type="text/JavaScript">
//Script courtesy of divyanshudaiya.com
var message="NoRightClicking";
function defeatIE() {if (document.all) {(message);return false;}}
function defeatNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=defeatNS;}
else{document.onmouseup=defeatNS;document.oncontextmenu=defeatIE;}
document.oncontextmenu=new Function("return false")
</script>
Note: To copy and paste the code, highlight it by clicking and holding your mouse button down and dragging the cursor from the beginning to the end of the code, then release the mouse button. When you have the code highlighted, press Ctrl + C on your keyboard to copy it. Press Ctrl + V to paste it into your page.
You can paste the script anywhere on your page. I placed it at the end of the source code just before the </body> tag to keep it out of the way. You'll appreciate that when you want to edit the page.
By combining a no right-click script with a no copy & paste script you'll add another layer of difficulty for those trying to steal your text. Use my HTML Code Protectorto make it as difficult as possible for someone to steal your content. Be warned though, a savvy and determined user can still figure out ways around all the protection, nothing is perfectly safe on the Internet. Fortunately, not many people want to spend that much time at it when it's much easier to go steal from someone else.
Note: This script may not work in all browsers. It does work in Internet Explorer and Firefox, which comprises the overwhelming majority of users