views:

30

answers:

3

Hi folks,

I know everyone hates when their context menus get messed with so what I'm asking for is the opposite of that. I've tried looking for javascript plugins that deal with changing the context menus in webpages, but I find that they are very intrusive. (i.e. the context menu now only contains the items that the developer chooses). Is there a way to simply add an item to the context menu, all while keeping the user's normal items and at the same time keeping the native style of the menu? The same plugins I have found require the developer to define a new style for the menus. I don't see the point in reinventing the wheel.

I ask because a client of mine wants to add extra functionality to the site when the user right clicks.

+1  A: 
  • The context menu can't be modified via normal javascript + DOM. It (usually) can be suppressed and replaced by some dynamic HTML that looks and acts like a context menu. This is why the styling appears different, and why you can't combine built-in and custom context menus... 'context menus' done in javascript are not really context menus at all.

  • The context menu may be disabled if the event is cancelled, but that's up to the browser -- most browsers provide an option to disallow hiding the context menu; if that's enabled then even if the event is cancelled the menu will show. This results in two "context menus" displaying, the real context menu and the faked-up javascript one.

  • To style web pages based on the user's system appearance, use the system colors defined in CSS2 ( http://www.iangraham.org/books/xhtml1/appd/update-23feb2000.html ) and/or the CSS3 appearance property ( http://www.w3.org/TR/2004/CR-css3-ui-20040511/#system )

Edit: In response to "a client of mine wants to add extra functionality to the site when the user right clicks" -- you might want to advise the client that they should only do this if the site is a web application (for example like google docs) where users would reasonably expect the context menu to do something out of the ordinary. You should also make sure that there is a non-hidden way to do everything that can be done via the context menu.

no
A: 

Thank you for your insight, no. I didn't think the context menu was the best way to go but he's the one with the paycheck. (I apologize for responding to this as an answer. I couldn't find a way to respond to your answer specifically.)

vince
No problem... there's a little 'add comment' link at the bottom of each post for that. There should also be a button to accept it as a correct answer somewhere ;)
no
A: 

Normally there would be a link but I can't find it for some reason. Maybe because I'm not a registered user? I believe that's the reason why I can't accept your answer as well.

vince
That's probably it. You should register, it's pretty painless...
no