iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-09-2009, 01:26 AM
sushil's Avatar
WebProWorld Pro
 
Join Date: Apr 2008
Posts: 127
sushil RepRank 1
Default Disable right mouse click script

This is a cross browser DHTML script that will prevent the default right menu from popping up when the right mouse is clicked on the web page. Use it to stop surfers from easily saving your web page, viewing its source, or lifting images off your site when using either IE 4+ or NS 4+.

Code:
<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// --> 
</script>
Reply With Quote
  #2 (permalink)  
Old 01-09-2009, 07:20 AM
DaveSawers's Avatar
WebProWorld Veteran
 
Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 438
DaveSawers RepRank 1
Default Re: Disable right mouse click script

All that disabling the right click menu will do is p#$s off your visitors so they go somewhere else for their information. It won't stop any hackers from stealing whatever they want as there are many other ways of getting that information.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #3 (permalink)  
Old 01-09-2009, 09:18 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,376
wige RepRank 5wige RepRank 5wige RepRank 5wige RepRank 5wige RepRank 5wige RepRank 5
Default Re: Disable right mouse click script

Most Windows XP keyboards have a key that looks like a little menu, which does the same thing as clicking the right mouse button. Disabling the clicks will have no effect on most visitors anymore. In addition, everything a browser displays is cached on the user's computer and can be retrieved in a few clicks anyway.
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog
Reply With Quote
  #4 (permalink)  
Old 01-09-2009, 09:57 AM
Webnauts's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Aug 2003
Location: Worldwide
Posts: 7,968
Webnauts RepRank 4Webnauts RepRank 4Webnauts RepRank 4Webnauts RepRank 4
Default Re: Disable right mouse click script

Disabling the right mouse click sucks. It is unusable and useless!
Reply With Quote
  #5 (permalink)  
Old 01-09-2009, 01:06 PM
CarolSLC's Avatar
WebProWorld Member
 
Join Date: Dec 2008
Location: Salt Lake City, Utah, USA
Posts: 35
CarolSLC RepRank 0
Default Re: Disable right mouse click script

I'm currently building a new site for a client who specifically requested that I disable the right mouse click on her site. She didn't want people to steal her content and images that she feels she worked so hard on. I didn't want to do it, but now I have facts to go back to her with as to why we shouldn't bother. Thank you!
Reply With Quote
  #6 (permalink)  
Old 01-15-2009, 04:10 PM
WebProWorld New Member
 
Join Date: Jan 2009
Posts: 13
owt200x RepRank 0
Default Re: Disable right mouse click script

there are body codes that disable right clicking and text highlighting, but they only work in IE I think.

When I go to a site that has rightclick disabled, I go through their code to see whats important enough to do that. 100% of the time all it is, is they dont want their image links copied, which can be foind in the source anyway.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Web Browsing?? design@divergentweb.com Breakroom (General: Any Topic) 26 Yesterday 07:41 AM
flash enable or disable detection script tricker Flash Discussion Forum 1 01-28-2008 06:01 AM
Disable session IDs in URL computergenius Web Programming Discussion Forum 10 11-08-2006 09:50 AM
Anyone know a good free click tracking script? BobbyBill Graphics & Design Discussion Forum 0 06-22-2006 06:40 PM
Disable Right click menu on .swf file in browser window... meenu Flash Discussion Forum 1 04-29-2004 10:59 AM


All times are GMT -4. The time now is 11:04 AM.



Search Engine Optimization by vBSEO 3.3.0