Jump to content

No Right Click (for images)


Recommended Posts

(4.0+ browsers) Ever wanted to prevent users from "borrowing" images from your site through right-clicking them and "save image as..." or right-clicking the page and viewing your page source? This java-script will (attempt to) disable the right click on your page! As explained, however, this script is not fool-proof !!

<!-- TWO STEPS TO INSTALL NO RIGHT CLICK:

  1.  Copy the coding into the HEAD of your HTML document

  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<script LANGUAGE="JavaScript1.1">

<!-- Original:  Martin Webb (martin@irt.org) -->

<!-- This script and many more are available free online at -->

<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

function right(e) {

if (navigator.appName == 'Netscape' &&

(e.which == 3 || e.which == 2))

return false;

else if (navigator.appName == 'Microsoft Internet Explorer' &&

(event.button == 2 || event.button == 3)) {

alert("Sorry, you do not have permission to right click.");

return false;

}

return true;

}

document.onmousedown=right;

document.onmouseup=right;

if (document.layers) window.captureEvents(Event.MOUSEDOWN);

if (document.layers) window.captureEvents(Event.MOUSEUP);

window.onmousedown=right;

window.onmouseup=right;

//  End -->

</script>

</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<center>[ Try right-clicking the image and then the text link below ]

<p>

<img src="http://javascript.internet.com/img/tjsbutton.gif">

<p>

<a href="http://javascript.internet.com">Text Link</a>

<p><center>

<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>

by <a href="http://javascriptsource.com">The JavaScript Source</a></font>

</center><p>

This was taken from - http://javascript.internet.com/page-detail...ight-click.html.

Link to comment
Share on other sites


Not fool proof at all
If anything can be done, it can be undone as well.

Of course, but it prevents the casual surfer from laying hands on your images.

**Response to below:

Microsoft offers code, to disable the Image toolbar popping up on a page.

Link to comment
Share on other sites

if you place your cursor over an image, a little toolbar pops up, press save and voila! you bored an image.

if you would place your images in flash, any way you like (viewer, movie etc.)

then the pop up won't work + you can't right-click on an image an choose save as since it is a .swf

Link to comment
Share on other sites

  • 2 weeks later...
Not fool proof at all, and btw there is a AllowRightClick extension for firefox :)

lol, one of my "Must Have" Extensions... I hate sites that try blocking the right click. and if the right click extention doesn't work... its a simple Tools -> Page Info -> *media tab* -> Pick the picture and hit save lol.

if that second thing doesn't work... just hit the print screen button go to paint, paste the image and save lol. :P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...