View Full Version : Disabling clicks

11-07-2005, 01:44 AM
How do I disable clicking with teh right hand side of the mouse. I know it is possible but I dont know how.

11-07-2005, 04:07 AM
In the future you should try searching the forums:

Q. How can I use Javascript to protect my web pages?

A. Short answer, you can't.

Long Answer:

Since visitors to your web site can disable Javascript in their browser, javascript can't be used as a protection mechanism.

Even without disabling Javascript I can easily see the whole code for your web page by simply running another javascript which will undo anything you did to make the page unavailable. Search for "Bookmarklets" in Google for a bunch of simple but useful scripts like that which can be set up as Bookmarks (Favorites for you IE users).

Please note that "No Right Click" scripts (one of the favorite uses of javascript to "protect" a web page) are considered at best a "waste of time" but more often as "user antagonistic" by most of the regulars here. You can get answers on how to write them, fix them and the like eventually but you may find yourself running a gauntlet of questions about why you would want to do such a thing before you get assistance. Scripts that make it harder to provide help do not endear you to the volunteers who provide the help.

There also several dicussions on the topic. The simple fact is, while you can disable the right click, its a useless thing to do, as its very easy to get round. I have a bookmarklet (A bookmark that runs some kind of JavaScript code), and by clicking this bookmark all no-right-click scripts are disabled.

11-07-2005, 02:37 PM
Besides that, interfering with the user's interface like that and messing up the -very useful!!!- context menu is very rude.

11-07-2005, 07:22 PM
While I also strongly believe against the idea the other posters in this thread, if you still really want to do it you'll need some javascript to do it. You can probably find the code by searching google pretty easy for javascript "disable right click"

11-07-2005, 07:28 PM
Despite your best attempts to prevent the user from getting your info please realize that they already have it in their cache and there is nothing you can do to prevent them from just pulling the content from that locale.