PDA

View Full Version : Disable right-click for your website!



Sameer!
14-03-2009, 12:54 PM
Hello!

I found this great script coded in javascript that disabled right-clicks on webpages. Basically no-one can right-click on your page.

Here it is: Remember to put this code into the BODY of your webpage in HTML.


<script language=JavaScript>
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.oncontext menu=clickIE;}

document.oncontextmenu=new Function("return false")
</script>Thankies! :P

Protege
14-03-2009, 12:59 PM
omg gr8 post +rep!!!

Monopoly
14-03-2009, 01:08 PM
ughhhh. i hate when people disable right-click. :@

Josh-H
14-03-2009, 01:20 PM
This is pointless and annoying, there's plenty of ways around it.

People can just save your source, edit out the javascript and then open it.

Iszak
14-03-2009, 01:22 PM
Seriously this is completely pointless - if it's to stop them viewing the source, they can just do view -> page source or what ever it is for their browser. If it's to stop them from stealing images, they can easily disable JavaScript. Seriously disable right click is just a pain because it stops you from being able to do right click -> open in new window or tab. Sure you can do this with ctrl but still just no.

Dentafrice
14-03-2009, 01:55 PM
Seriously.. seriously.. this is stupid.

It's no protection whatsoever, and it just makes you look absolutely stupid when someone right clicks and it says "Images Copyright MEz!1!!"...

Thanks for providing it though? I guess? Not.

Sameer!
14-03-2009, 07:41 PM
Guys, please. I just found this I just wanted to share this with you. I didn't want any anger or anything...Well if you guys are like that...whatever.

Recursion
14-03-2009, 08:13 PM
Thats just annoying, immagine how much more annoying it would be to get image sizes for e.g. our ICT coursework.

Protege
14-03-2009, 08:21 PM
Thats just annoying, immagine how much more annoying it would be to get image sizes for e.g. our ICT coursework.
wat...

Edited by MattGarner (Forum Super Moderator): Please don't post pointless comments, please make them more constructive to the actual post/thread.

e5
14-03-2009, 08:26 PM
o nooezzz sum1 stole ma habbo picz from meh websyt !!!!

who cares lol. if they steal if and its urs u can prosecute cant u or sumin so let em take it then get da muneyz

emotional
14-03-2009, 09:16 PM
i guess people really despise this script, and is pretty pointless, but heh, i guess it's alright for reference purposes.

Kyle!
15-03-2009, 02:32 AM
The Sun's website does this and it makes them look like utter technophobes.

Sameer!
15-03-2009, 08:32 AM
lol that would be funny

Samishlol
15-03-2009, 09:08 AM
Great help +rep

Dentafrice
15-03-2009, 02:24 PM
lol that would be funny

What do you mean "that would" be funny.. that's what they do..


Great help +rep

If you thought this was "great help", please shoot yourself now.

What is this section coming to. :rolleyes:

Protege
15-03-2009, 02:51 PM
*REMOVED*


Edited by Yoshimitsui (Forum Super Moderator): Please do not create pointless posts.

Apui
15-03-2009, 05:55 PM
Thanks for thinking of others.

MrCraig
15-03-2009, 08:32 PM
thanks for providing it but theres no point..

It'll maybe filter out 1% of the population of OAPs afraid to view page source or disable javascript in case their computer explodes.

Meti
21-03-2009, 04:59 PM
Why not do:
body {
website: no-clicking-on-links;
website-safety: ban-if-done;
}
Thats how I do it.

brandon
21-03-2009, 05:02 PM
All I do is right click quickly about 5 times and it avoids it when I try to save pictures from The Sun.

Agnostic Bear
21-03-2009, 05:31 PM
Why not do:
body {
website: no-clicking-on-links;
website-safety: ban-if-done;
}
Thats how I do it.

That's not even valid in anything :S

Dentafrice
21-03-2009, 05:45 PM
That's not even valid in anything :S
I think he was trying to be funny.

Meti
25-03-2009, 03:22 PM
Nah. It was just sarcasm.

Jonster
27-03-2009, 11:02 PM
Hello!

I found this great script coded in javascript that disabled right-clicks on webpages. Basically no-one can right-click on your page.

Here it is: Remember to put this code into the BODY of your webpage in HTML.


<script language=JavaScript>
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.oncontext menu=clickIE;}

document.oncontextmenu=new Function("return false")
</script>Thankies! :P

Known this for some time now - not really useful. If you are worried about images getting stolen, just stick a watermark or copyright text over the image.


Seriously this is completely pointless - if it's to stop them viewing the source, they can just do view -> page source or what ever it is for their browser. If it's to stop them from stealing images, they can easily disable JavaScript. Seriously disable right click is just a pain because it stops you from being able to do right click -> open in new window or tab. Sure you can do this with ctrl but still just no.

Alternatively you can just middle mouse click on the link - this opens it in a new tab.

Calgon
28-03-2009, 10:41 AM
+REP for creativity.

UrbanRyan
28-03-2009, 10:45 AM
but you can still drag the images, onto your desktop?

Dentafrice
28-03-2009, 01:04 PM
Yeah, pretty much. Hence why this is useless.. except for the garbage.

Dentafrice
28-03-2009, 01:34 PM
If you're going to leave me a -REP, at least leave your name.

I honestly don't care if you're tired of my "rudeness", it's the truth.. and if you don't like it, you can take a swift kick back to the Habbo section.

Want to hide these adverts? Register an account for free!