Jump to content

How do i disable right-click?


aksha81

Recommended Posts

I strongly reccommend NOT to disable right click...Everyone hates it.If you still want to, it can only be done by Javascript, however, it can be de-activated from your page, when installed.

Link to comment
Share on other sites

First, I must tell you. If you are doing this to prevent stealing of your images it won't work. They can hold down left click and drag it off of the page and it will save it. If you are doing it to prevent viewing of the source code you can still click view source in the menu. There is nothing that disabling the right click will do except make people angry. However, since you asked

<script language=JavaScript>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>

Link to comment
Share on other sites

more simply <body oncontextmenu="return false;">I haven't seen any that work for Opera (havent bothered looking tbh)There are ways around it like everyone has already said

Link to comment
Share on other sites

To get one thing straight: disabling something for the user is always done by JavaScript (or oher scriptlanguage) and is always alterable by the user.For example, try viewing a page that has an image. replace the text in the addressbar with this:

java script:alert(document.getElementsByTagName("IMG")[0].outerHTML="Here WAS an image!")
And hit enter twice. See the image dissappeared :) Everything may be edited privately like this...So any script that disables something may get disabled theirselfs by the user :)
Link to comment
Share on other sites

To get one thing straight: disabling something for the user is always done by JavaScript (or oher scriptlanguage) and is always alterable by the user.For example, try viewing a page that has an image. replace the text in the addressbar with this:And hit enter twice. See the image dissappeared :) Everything may be edited privately like this...So any script that disables something may get disabled theirselfs by the user :)

Okay, okay, i was just trying...and yeah, it was to protect some images...i guess i should add "print screen" to your list of ways to copy an image :). Anyway, thank you!
Link to comment
Share on other sites

Or take a look in your tempory internet files.Or save the page to your desktop and the image are in the folder.There is always a way around the no right click script and is a total waste of time and annoying for anybody who needs to help you with your coding in the future. But most importantly welcome to the group matey. :)

Link to comment
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
×
×
  • Create New...