| | |
wanna help..how to avoid default context menu
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2006
Posts: 4
Reputation:
Solved Threads: 0
Hai group,
im a newbie in HTML,CSS,JAVASCRIPT..
I was involved in dev of a prototype using the above 3...
everything went fine...but the pending requirement is ..
when we right click on a row in table in a prototype, we have coded such that a context menu appears..its working fine..but if we click on empty space in the html prototype, we r getting the default context menu which we dont want...
could any one of u can help me plzzzzzzz
im a newbie in HTML,CSS,JAVASCRIPT..
I was involved in dev of a prototype using the above 3...
everything went fine...but the pending requirement is ..
when we right click on a row in table in a prototype, we have coded such that a context menu appears..its working fine..but if we click on empty space in the html prototype, we r getting the default context menu which we dont want...
could any one of u can help me plzzzzzzz
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
Wait... I know IE provides an "oncontextmenu" event handler. I'm not sure about FireFox.
You could code that in the body, as so:
However, this is where I make my standard plea/warning: users expect that when they right-click, they get a context menu. I, for example, routinely use it to access "back". It's faster than mousing up to the top of the browser. Disabling or co-opting features that users have come to expect violates a basic application design principle, and should be avoided, in my opinion.
So unless you have a very compelling reason for doing this, I would suggest that you leave it alone.
You could code that in the body, as so:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<body oncontextmenu="return false;">
However, this is where I make my standard plea/warning: users expect that when they right-click, they get a context menu. I, for example, routinely use it to access "back". It's faster than mousing up to the top of the browser. Disabling or co-opting features that users have come to expect violates a basic application design principle, and should be avoided, in my opinion.
So unless you have a very compelling reason for doing this, I would suggest that you leave it alone.
•
•
Join Date: Mar 2006
Posts: 4
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by tgreer
Wait... I know IE provides an "oncontextmenu" event handler. I'm not sure about FireFox.
You could code that in the body, as so:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<body oncontextmenu="return false;">
However, this is where I make my standard plea/warning: users expect that when they right-click, they get a context menu. I, for example, routinely use it to access "back". It's faster than mousing up to the top of the browser. Disabling or co-opting features that users have come to expect violates a basic application design principle, and should be avoided, in my opinion.
So unless you have a very compelling reason for doing this, I would suggest that you leave it alone.
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
We're venturing off into another discussion. I don't know the particulars of the OP's environment or application, but in general, I say "hands off" on anything that is in the User Model. This includes such often-requested items as auto-sizing a window, auto-printing a page, disabling certain script warnings, obscuring or making "View Source" difficult, and replacing or editing the context menu.
This link should be of interest to you in regard to adding to context menu(s):
http://msdn.microsoft.com/workshop/b...ls/context.asp
This link should be of interest to you in regard to adding to context menu(s):
http://msdn.microsoft.com/workshop/b...ls/context.asp
That's something you have to do internally to your windows machine though (which rocks for me, but not for someone trying to do it through a web page... now if we can find out where that same type of key is for firefox).
If I'm not mistaken, you could use a DIV with some crazy CSS (to hide and show the div) with an absolute positioning, set the oncontextmenu to a function (which shows the div, and returns false for the actual context menu), but the context menu has things that you can't make happen within a page.
but I seriously agree with tgreer, screwing with people's interface is a bad idea.... 9 times out of 10, if a page is messing with things I don't think it should be, I'm gone. I won't stay there. I don't even like pages playing music, or embedding objects (like media player) when I first navigate there. Now, I've done this before (made a page which replaces the context menu), but I made it a choice in preferences, and I made it disabled by default (meaning, in order to use my div menu, they had to consciously go in and turn it on), and beyond that, I made an option in the DIV for "Standard Menu" so when they clicked that, it would load the normal context menu the next time they clicked.
If you feel absolutely drawn to having to affect the users interface, words of wisdom say to make sure that the user can get back to a familar environment with no effort.
If I'm not mistaken, you could use a DIV with some crazy CSS (to hide and show the div) with an absolute positioning, set the oncontextmenu to a function (which shows the div, and returns false for the actual context menu), but the context menu has things that you can't make happen within a page.
but I seriously agree with tgreer, screwing with people's interface is a bad idea.... 9 times out of 10, if a page is messing with things I don't think it should be, I'm gone. I won't stay there. I don't even like pages playing music, or embedding objects (like media player) when I first navigate there. Now, I've done this before (made a page which replaces the context menu), but I made it a choice in preferences, and I made it disabled by default (meaning, in order to use my div menu, they had to consciously go in and turn it on), and beyond that, I made an option in the DIV for "Standard Menu" so when they clicked that, it would load the normal context menu the next time they clicked.
If you feel absolutely drawn to having to affect the users interface, words of wisdom say to make sure that the user can get back to a familar environment with no effort.
![]() |
Similar Threads
- HDD Context Menu gone Awry (Windows NT / 2000 / XP)
- context menu (VB.NET)
- slow startup and modem speed (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Please help, been a few years.
- Next Thread: Dynamically write selectedIndex to a <dl> element
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically browser bug calendar captchaformproblem cart checkbox child close codes createrange() cursor date debugger dependent disablefirebug dom dropdown editor element embed engine events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp jump libcurl maps masterpage math media microsoft object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post programming progressbar prototype redirect regex runtime safari scale scriptlets scroll search security shopping size software sql text textarea unicode web website windowsxp wysiwyg \n






