View Full Version : disbale right click for specific links?

09-09-2008, 12:06 PM
Hello All,

I am trying to disable right click only for specific links on the page> I want to create my own pop up menu for these eventually. At present I have the following

<a href='#' onContextMenu="typesclick()">Types</a>

the function is

function typesclick()

return false;


The alert appears but the browser context menu also appears. I am using ie7? Any ideas why this is not working?

Scott Bailey

Philip M
09-09-2008, 12:32 PM
See FAQ No.13.

"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 cannot suppress the browser context menu in IE7 - this is a security feature set by the user.

09-09-2008, 01:13 PM
Leave the right click functionality as it is. As a user I would be annoyed if you will change my mouse's right click functions, so that either I will quit your page and never come back or I will disable javascript to avoid that unpleasent change.

Use the left click (or mouseover) for contextual menus.

09-09-2008, 04:05 PM
put a quick password protect script on the pages you dont want people seeing or uhh "clicking" lol.

or redirect script
or a tooltip saying "under-construction"

or just simply make the link say
<a>Types</a> with no link in it
....and change it back until you're done :) there, we all happy :p

you can even combine these :D xD

there's lots more you can do lol