html tutorials web design help css tutorials free web graphics diy search engine optimization

No Right-click Code

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
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.oncontextmenu=new Function("return false")

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 Protector to 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.

Back | Web Design Tutorials Index

Ezine for Webmasters

Bookmark and Share

Almost a Newsletter

Changing list hosts. Will post a new subscribe form shortly.

Did you know...

The member's site has about 100 standards compliant HTML and CSS tutorials, 31 handy reference charts, reprintable content, web graphics, exclusive fonts, free software, free ebooks and more? All this for less than 9 cents a day! [ Details ]
See my fancy bottom! :)