Disabling right-click - JavaScript code

Disabling Right-Click on a web page

also Protect images


Protect images/Disabling right-click on a web page

Want to protect your source code? Using this code will prevent the vast majority of users from right-clicking over a page and choosing "View source", or right-clicking over an image and saving it. There are other ways to view the code, though... This is not always a wise technique to use - it would have to be a very special piece of code to want to hide, and those who would want to steal it will always be able to find a way to see it.

Try right-clicking on this page as an example.

<SCRIPT TYPE="text/javascript">
//Disable right click script
//visit http://www.rainbow.arch.scriptmania.com/scripts/
var message="Sorry, right-click has been disabled";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(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")
// -->

Place the above code into <HEAD></HEAD> of your HTML.   ...... How to?

To disable the IE imagetoolbar also add the META TAG below to the HEAD

<META HTTP-EQUIV="imagetoolbar" CONTENT="no">

To protect TEXT add 'Disable Text Select' code below into <HEAD></HEAD> of your HTML.

<SCRIPT TYPE="text/javascript">
//Disable select-text script (IE4+, NS6+)
//visit http://www.rainbow.arch.scriptmania.com/scripts/
function disableselect(e){
return false
function reEnable(){
return true
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
// -->

Ways to protect your images

To start off, the straight truth is there is no 100% way to protect your images short of not displaying them on the Internet to begin with. There are many ways to prevent a novice visitor, but no matter what you try, there will ALWAYS be a way to get any image. That said, here are a few attempts you may try in no particular order.

1. Using CSS to position a transparent gif overtop of the image.
<img src="myimage.gif" width="100" height="50">
<img src="transparent.gif" width="100" height="50" style="position:relative; left:-102px; top:0px;">

2. Using span tag to position a transparent gif overtop of the image.
<span style="background-image: url(images/my_image.jpg)"><img src="images/transparent.gif" width="200" height="150" border="0" alt="My protected Image."></span>

3. Use the image as a background of a table and fill the cell with a transparent gif.
<table width="100" height="50">
<td background="myimage.gif">
<img src="transparent.gif" width="100" height="50">

4. Use a watermark.
That is, put a mark on the actual image with an image software. A word, a small graphic logo, anything that would deter a thief but still look nice visually for the common visitor.

Here are a number of very effective methods of keeping unscrupulous surfers from stealing your HTML source:

1. Use the <INVISIBLE> </INVISIBLE> tags around the entire document.  [ Menu > View > Source.  To see this one. ]

2. Use the DONTSTEAL attribute in the <BODY> tag.

3. Ftp to your server, select all files and directories, hit "Delete".

4. Put every existing copy of every file on floppies, place them in a shoebox and bury them in the backyard. There is another version of this method which involves placing the floppies in a plastic bag and hiding them in a different sort of hole. Both are equally effective.

5. Password protect your entire site and make sure no one has the password, not even you.

6. Employ a small but fanatically loyal and well-armed band of mercenaries to guard your site.

7. Start>Run>format C:\

8. Attack dogs, preferably rabid.

9. Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.)

10. Don't put your pages on the web.

How To steal 'NO RIGHT CLICK' code :-

Use Left mouse and drag to highlite the code, (or try, cursor over code and triple left click)
then use keys [Ctrl + C] to copy and then paste [Ctrl + V] where you want it.