Detect right click menu selection using javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rchak2k
    New Member
    • Oct 2007
    • 2

    #1

    Detect right click menu selection using javascript

    Hi!

    I have to capture the event of mouse right click menu selection.
    e.g. I need to capture the event if someone click the "close X" option displayed at the bottom of the right click menu. Any idea??

    thanks!!
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    See this link.

    Comment

    • rchak2k
      New Member
      • Oct 2007
      • 2

      #3
      Thanks, but that doesnt exactly solve my problem. I need to capture more than just right click, i need to capture the event when user clicks on the menu options of the right click window, viz. the "close" option.

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        Originally posted by rchak2k
        Thanks, but that doesnt exactly solve my problem. I need to capture more than just right click, i need to capture the event when user clicks on the menu options of the right click window, viz. the "close" option.
        Are you looking for some code to be executed before the page gets unloaded?
        Right :-)

        Then try .....

        [code=javascript]
        window.onbefore unload = function(){
        //your clean up code
        }
        [/code]

        Mind it, it does not work in Opera.

        Kind regards,
        Dmjpro.

        Comment

        Working...