Important alert: (current site time 7/15/2013 12:04:48 PM EDT)
 

VB icon

_ Right click disabler _ (not foolproof) _

Email
Submitted on: 12/6/2000 4:39:32 PM
By: paul_cormie 
Level: Intermediate
User Rating: By 12 Users
Compatibility: JavaScript
Views: 27634
(About the author)
 
     
SUPER EASY CODE!


1 line is all it takes to stop users from either saving pictures on your site or viewing source.
disables the right click. See the screen capture for the alert that comes up.
Very easy to customize this alert...into, for example a copyright notice.



Enjoy....LOTS more to come (note : this is not foolproof - nothing is...)

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: _ Right click disabler _ (not foolproof) _
' Description:<b><br>SUPER EASY CODE!</b><br><br>1 line is all it takes to stop users from either saving pictures on your site or viewing source.<br>disables the right click. See the screen capture for the alert that comes up.<br>Very easy to customize this alert...into, for example a copyright notice.<br><br><br><br> Enjoy....LOTS more to come (note : this is not foolproof - nothing is...)
' By: paul_cormie
'
' Returns:msgBox "Disabled"
'
' Assumes:absolutely nothing at all! The html is in the code so it's as easy as cut and paste!
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=2015&lngWId=14'for details.'**************************************

<html>
<head>
<title>Just try to right click on me</title>
</head>
<script>
<!-- JavaScript Start -----
function click() {if (event.button==2) { alert('Disabled') } } document.onmousedown=click
----- JavaScript End ------>
</script>
<body>
Just try to right click
</body>
</html>


Other 7 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

12/11/2000 2:04:59 PMlilly

Thank you very much. Your code has help me greatly with my art on the web.
(If this comment was disrespectful, please report it.)

 
12/13/2000 8:23:33 AMDaniel Engvall

Good code but only one problem, if you press and hold down right button, press esc and then release the right button the menu still comes up
(If this comment was disrespectful, please report it.)

 
2/20/2002 5:48:29 AMSeth Lynch

This doesn't work with Netscape browsers.
(If this comment was disrespectful, please report it.)

 
2/20/2002 12:32:54 PMpaul_cormie

nothing is fool-proof.

it is impossible to stop a skilled web user from viewing the source of your web page
(If this comment was disrespectful, please report it.)

 
4/5/2002 9:11:40 AMBrian L

you can allways do it with telnet or something similar, but nice code tough.
(If this comment was disrespectful, please report it.)

 
4/21/2002 10:13:25 PMmax

hold down sift, then click, and drag cursor and let go, walaa
(If this comment was disrespectful, please report it.)

 
4/22/2002 12:11:27 PMpaul_cormie

see title (not foolproof).

also try right click then hitting escape quickly. walaa.
(If this comment was disrespectful, please report it.)

 
7/31/2002 9:35:43 AMA1Programmer

Or hold the Left Button... Hold the Right Button, Release the left, and then right button and don't worry about touching the keyboard... :)
(If this comment was disrespectful, please report it.)

 
12/23/2002 3:39:52 PM

Wonderful
code!
(If this comment was disrespectful, please report it.)

 
3/21/2003 7:48:45 AM

Nice trick, it works for novice users. But you can always open the URL in Front Page, save the page. And hence, get to the code or picture you want.

(If this comment was disrespectful, please report it.)

 
4/24/2003 5:23:23 PMWilliam Toledo

no big deal, users still can have access to all features of the right click using the item on the menu bar...
There is a any way to disable for example the
(If this comment was disrespectful, please report it.)

 
1/5/2004 2:07:42 PM

in visual basic it takes one line of code to view source of a webpage inet1.openurl(http://www.address.com).
(If this comment was disrespectful, please report it.)

 
3/22/2004 1:36:30 AMdemon

Anti right click usually just annoys me into wanting to steal the source of sites i just wanted to open a url in a new page from. I almost feel like starting gotsource.com and posting the source code of the sites that use anti right click scripts for everyone to see. Under the fair use act, of course.
(If this comment was disrespectful, please report it.)

 
8/26/2004 7:22:10 PM

..
(If this comment was disrespectful, please report it.)

 
2/22/2005 9:45:45 AM

Leave the guy alone . . .
Nice idea mate. Most users like my wife, my sister, my mum, my dad and most of my in-laws wouldn't have a clue how to get around this . . .
But, then again they probably won't try right_clicking anything to try and save it!
(If this comment was disrespectful, please report it.)

 
2/22/2005 10:25:03 AM

Can you not just save the webpage (without Forntpage) and you get all the associated files.
I don't really care - big 5 for you dude!
(If this comment was disrespectful, please report it.)

 
10/30/2005 3:07:34 AMmichael (mkb)

its good anothe 2 stop d average person tryin 2 save a pic course u can still always juz download the entire page or look at the source but on the average person dnt know how 2 do dat
(If this comment was disrespectful, please report it.)

 
7/17/2006 8:20:24 AMmahesh

it is very useful code i like that
thanks
(If this comment was disrespectful, please report it.)

 
1/16/2007 3:18:30 AMSriram

Simple and Nice
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.