Disable right-click?

liunx

Guest
Does anyone know how to disable right-click?:confused:<!--content-->Even if you disable it, the files are still Download <!--more-->ed to the users browser cache and then displayed by the browser from there.<br />
<br />
There are many ways around it. Quite honestly, you are wasting time doing this. It isn't worth the bother.<br />
<br />
If you are trying to protect images from being saved, then instead put a digital watermark on them.<br />
<br />
If you are trying to stop people looking at your code then, you can't; well, not unless you start doing stuff with server side languages, but even then, anyone can still look at the HTML code that is generated.<!--content-->use this, but remember what giz said.<br />
<script language="JavaScript"><br />
<!-- <br />
var debug = true;<br />
function right(e) {<br />
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false;<br />
else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {<br />
alert('Denied!');<br />
return false;<br />
}<br />
<br />
return true;<br />
}<br />
document.onmousedown=right;<br />
if (document.layers) window.captureEvents(Event.MOUSEDOWN);<br />
window.onmousedown=right;<br />
--><br />
</script><!--content-->A big problem with right-click scripts is that they also prevent users from right-clicking to stay on your own very interesting and excellent page, while opening another window to follow one of your links (so they can go back to your page without reloading it). I sometimes get on a page I want to stay on, right-click to take a peek at a link, and then either get refused or a javabox telling me I'm doing something wrong, when all I want to do is open a window and not leave the site - with the inevitable thought, "damn right - click nazi." It tends to be more amateurish pages which use this, in my experience. Experienced webmasters know that this will just drive users further to get the goodies, and guys that are mad at you might even go ahead and hotlink your gifs. Nightmare!<br />
<br />
I've seen other suggestions for doing something similar without looking like you're a right-click nazi. You can slice your gifs up so anyone stealing them at least has to paste them together -- this will be a big turn-off for most since stealing gifs is for the lazy, and lazy people don't want to go through the hassle. Or you can use them as background images in your body or in tables, and this also prevents a quickie right-click (though users might be able to grab it through the desktop wallpaper option). Or even one really funny suggestion I've seen, but it's a bit of trouble: make it your background, and then put an invisible gif on top of it -- a very good chance your right-clickers won't know what happened to them, saving something that they can't see even though it showed up on the webpage.<!--content-->excellent points! i've seen the clear overlay trick, and it's mad brilliant! too bad it is such a hassle, though :(<br />
<br />
i also use right-click to stay on the page while surfing elsewhere, and it IS annoying when you can't do that.<!--content-->I totally agree with these guys disabling right click can result as a hinderance and annoyance for people visiting your site, seriously. But hey you wouldnt want those big bad code/image thiefs pillaging and raping your site here is a applet for ure desierd function.<br />
<script language="Javascript"><br />
var ErrMsg = "Insert Error Test Here";<br />
<br />
function disableRightClick(btnClick)<br />
{<br />
if (navigator.appName == "Netscape" && btnClick.which == 3) // check for netscape and right click<br />
{ <br />
alert(ErrMsg);<br />
return false;<br />
}<br />
else if (navigator.appName =="Microsoft Internet Explorer" && event.button == 2) // for IE and Right Click<br />
{<br />
alert(ErrMsg);<br />
return false;<br />
}<br />
}<br />
document.onmousedown = disableRightClick;<br />
</script><!--content-->Haha mincklerstraat, some of that stuff you suggested was hillariously time consuming, but an awesome defense against those filthy image stealers, I just take the chance since I know the right click is a valuble asset to web browsing.<!--content-->Hey, thanks guys. Now i think disabling right click could result in a bit of a mess, and making it harder for the image hackers could encourage them for more colourful methods, ThEBoBoNgUS, thanks for the code i'l imput and test it. Thanks everyone!<!--content-->I agree about the no-right-click scripts being annoying. I use right-clicking to navigate websites; when I get to a site that blocks it, I leave.<br />
<br />
I've even seen scripts that prevent highlighting text. WTF? :rolleyes:<!--content-->http://www.vortex-webdesign.com/help/hidesource.htm<br />
click the link - read - and get the anti-right-clickscript<br />
and the view source script ;) :D<br />
<br />
** :rocker: **<!--content-->
 
Back
Top