Jump to content
xisto Community
Sign in to follow this  
KoYoda

No Right Click - Javascript No Right Clicking Script

Recommended Posts

I made this script for disabling the right-click option. It works with all major web browsers (IE, Mozilla, Firefox, Netscape...). Just put it into the head section of your document.

<script language="JavaScript">
var message="Sorry, no right clicking!";

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;

if (isIE||isNN) {
document.oncontextmenu=block;
}else{
document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
document.onmousedown=block;
}

function block(e) {
if (isN4) {
if (e.which==2||e.which==3) {
alert(message);
return false;}
}
else {
alert(message);
return false;}
}

</script>


You can edit the message wich is displayed after a user use the right-click: just edit the second line:

var message="Type here whatever you want...";

NOTE: This kind of script can be really annoying so use them carefully!

Cheers!


KoYoda

Share this post


Link to post
Share on other sites

This is great but do you know that unless you also hide your code and source that people can still get your photos. I used to work for a web company in the web design department so I know all the tricks to be able to grab photos and to get ideas from sources. You do not have to right click to look at the source in IE you just have to click on the view menu and mouse down to view source. There are tons of tricks like that. If you are trying to protect a image. Make sure you put a water mark across the whole picture that can not be removed by cropping.

Share this post


Link to post
Share on other sites

Blocking right click is completely pointless. For one thing, it doesn't work in good browsers, and second, it's very easy to do anything that you'd get from right clicking by going to the menubar or using a keystroke.

Share this post


Link to post
Share on other sites

Your pictures can still be copied even with this script. A visitor only has to click File --> Save As to copy the webpage to his computer. He can then open the folder for that page and the pictures would be there. :)

Share this post


Link to post
Share on other sites

how do you make watermarks that can't be moved or anything, i just add some text so that people that follow an honor system will not try to remove the url.

Share this post


Link to post
Share on other sites

How do a lot of people with the knowledge that they have to create scripts like this, not know that you can still view others Source Codes even with the script? There's a few ways around it.I'm not trying to embarass or 'flame,' please don't get me wrong, I'm just really curious...

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.