Results 1 to 2 of 2

Thread: Prevent middle click's default action?

  1. #1
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default Prevent middle click's default action?

    Hi all,

    Is there a way to prevent the default middle click action in IE7/8 or FF2/3?

    I don't mind resorting to browser detection if that's the only way to do something with middle click - I'm just wondering if it's possible.

    Even if the only thing I can do is use some proprietary IE stuff to give IE users a minor middle click enhancement, that's better than nothing.

    Thanks!

  2. #2
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    Just stumbled across this old thread.

    You *can* detect and respond to middle click in all browsers, assuming you don't mind browser sniffing (so it should be an enhancement, not part of normal functionality). This page helped me out:

    http://unixpapa.com/js/testmouse.html

    The trick to getting it to work for all browsers is to listen for the mousedown event rather than the click event (which doesn't always fire in IE for middle click).
    My site: FreshCut :)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •