Log in

View Full Version : how to disable right click?



yang_0104
07-24-2006, 05:20 PM
hi...i'm new here...and i would like to ask about disabling right mouse click.
how do u do that?can u give me the script?thx..

jscheuer1
07-24-2006, 05:42 PM
Please search the forums for previous discussions of similar topics before posting a question about such a much repeated topic.

The short answer to your post though is:

Don't do it to protect your material, it won't. That's what copyright is for. If you want to do it for cosmetic or functionality reasons, be careful as it could mess up other things about your page. Scripts are available in the script library. Go to:

http://www.dynamicdrive.com/

and use the search box in the upper right corner, try:

disable right click

Twey
07-24-2006, 05:47 PM
You can't. There are various scripts available that irritate users with annoying popups every time said user tries to right-click, but there's no way to reliably stop users right-clicking. The knowledgeable ones will just laugh off your attempts.

jr_yeo
07-25-2006, 01:11 AM
but here is the link (http://www.dynamicdrive.com/dynamicindex9/index.html) to no right click :p

jscheuer1
07-25-2006, 03:07 AM
Don't do it! :eek:

Twey
07-25-2006, 12:30 PM
You mean that script's still on DD? I thought it was going to be taken down.

mburt
07-28-2006, 11:15 PM
<script language="javascript">
document.oncontextmenu=function() {
return false
}
</script>

mburt
07-30-2006, 03:21 PM
What's wrong with the script I put above?

Twey

You can't. There are various scripts available that irritate users with annoying popups every time said user tries to right-click, but there's no way to reliably stop users right-clicking. The knowledgeable ones will just laugh off your attempts.

Twey
07-30-2006, 04:10 PM
What's wrong with the script I put above?It still doesn't work. :)

You're telling me a user can't get past that? In fact, a lot of browsers will simply disallow that by default, so the user would never even know it was there.

mburt
07-30-2006, 04:12 PM
It doesn't let you right-click in IE or Mozilla

Twey
07-30-2006, 05:15 PM
Oh doesn't it?
Install the latest version of Firefox. Try it.

Go to Edit->Preferences->Content and click the "Advanced" button next to "Javascript." There is a list of actions scripts should be allowed to take. "Disable or replace context menus" is disabled by default.

Besides, any user can get past this just by typing "javascript:void(document.oncontextmenu = null);" in his/her address bar, in any browser. Or even just disable Javascript.

mburt
07-30-2006, 05:22 PM
Oh, alright. But I recently downloaded firefox and it still cancels rightclick