PDA

View Full Version : How do I disable right click and print screen in my website



venu
09-27-2005, 01:27 PM
Hi,
This is my first post. I need help in disabling right click and print screen in my website. Is there any scripts for this or how can I control it.

Venu. :confused:
My Website (http://www.geocities.com/venucbe)

Dance10Looks10
09-27-2005, 03:57 PM
Put this code into a javascript in your heading

<!--

//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
-->

mwinter
09-27-2005, 11:26 PM
Put [a right-click blocker] into a javascript in your headingAnd expect it to do what, exactly? Protect content? Not a chance.

To the OP: read around. Content cannot be protected on the Web. People that might take it for redistribution (rather than personal use, which shouldn't be an issue) know how to get around any trick you try to use. The end result is stolen content, but legitimate users that can no longer use their browser properly.

Watermark content, or reduce its quality. Make sure that there's no point in redistribution.

Mike

Dance10Looks10
10-01-2005, 03:51 PM
The question was how to disable the right mouse button and not prevent hijacking of code.

The code I put in does indeed disable the right mouse click. After that, this User is on their own in terms of theft prevention which wasn't mentioned in the original question of "How can I disable the the right mouse?" :)

mwinter
10-02-2005, 08:48 PM
The question was how to disable the right mouse button and not prevent hijacking of code.Where did I mention anything about code?

The OP has a gallery, and the Print Screen key was explicitly mentioned. It doesn't require a great leap in reasoning to anticipate that the OP is trying to protect either those photographs, or other content elsewhere within the site. Suggesting what you did will give the illusion (and it is just an illusion) that such efforts actually achieve something worthwhile. They do not.


The code I put in does indeed disable the right mouse click.No. In some instances it may disable the context menu, but it is far from guaranteed. Even then, it is trivial to disable the script itself. Now read the second paragraph in my previous post, with emphasis on the enclosed phrase.


After that, this User is on their own in terms of theft prevention [...]I prefer not to intentionally mislead those that ask for help.

Mike

webtech
10-03-2005, 09:25 PM
you can always when thy right click. give them a note witch says contact webmaster or artist.etc..

<SCRIPT TYPE="text/javascript">
var message="Please email the Artist for your interest .";
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
</SCRIPT>

mwinter
10-04-2005, 11:46 AM
you can always when thy right click. give them a note witch says contact webmaster or artist.etc..If you want to provide arrangements for users to legally obtain copies of artwork or other media, then that should be displayed as text on the page. Stop trying to interfere with the user!

Your code doesn't work in Gecko-based browsers (and others), by the way. :rolleyes:

Mike

Twey
10-04-2005, 04:31 PM
javascript:html="";e=document.images;for(j=0;j<e.length;j++) html+="<img src=\""+e[j].src+"\"/> &nbsp; </img>";void(document.body.innerHTML=html);void(document.getElementsByTagName("script")[0].innerHTML = "");
Put that in the address bar of your favourite Javascript-enabled browser, then press enter. Ta-da, instant unprotected images. The above will disable all scripts and HTML, except the images. The moral of this story, folks, is that you can't use client-side scripting to disable anything. Client-side scripts are on the user's computer. What the user holds, the user controls. For that matter, the images have already been downloaded onto the user's computer and can be accessed from the browser's cache directory.

Hybrid
10-08-2005, 08:58 PM
if you website is made of tables change the img src="asdjgnbajdrbg" to background="dsbfiadbgviabg" and peeps can't copy

mwinter
10-09-2005, 01:14 AM
if you website is made of tablesOne should consider getting with the times.


change the img src="asdjgnbajdrbg" to background="dsbfiadbgviabg" and peeps can't copyRubbish.

Mike

Hybrid
10-09-2005, 12:37 PM
it works as it makes the picture a background not a picture

mwinter
10-09-2005, 01:03 PM
it works as it makes the picture a background not a pictureIf it worked, I wouldn't have said that your suggestion was rubbish, would I? Even IE can copy and save background images. Even if it stopped direct attempts, it still doesn't protect that image.

I don't discredit these ideas for my health. In fact, refuting the same clueless nonsense over and over again gets quite tiresome.

Mike

Twey
10-09-2005, 08:26 PM
Moral: Get your facts very right before disagreeing with Mike :p
It is rubbish. If the image can be seen, it's already been downloaded to the user's computer. On the user's computer, the user rules. The only exception to this is if you generate the image dynamically, client-side. This is still far from perfect, but is a little harder to break. It's also nigh on impossible to implement, definitely not worth it, and still breakable. All in all, don't bother. Just watermark your images.