how to send "click middle mouse button" to link

Discussion in 'Javascript' started by wpollans, Sep 7, 2007.

  1. wpollans

    wpollans Guest

    Hello,

    I need to able to write JS that will click on a link with the middle
    mouse button - so that the link target will open in a new window or
    tab - using firefox. Or is there a better (more reliable) way to have
    the link open in a new window/tab (using JS)? I have no control over
    the JS already on the page - this is for a selenium user extension
    that I'd like to write.


    Thanks,


    Warren
    wpollans, Sep 7, 2007
    #1
    1. Advertising

  2. wpollans

    RobG Guest

    On Sep 8, 5:53 am, wpollans <> wrote:
    > Hello,
    >
    > I need to able to write JS that will click on a link with the middle
    > mouse button - so that the link target will open in a new window or
    > tab - using firefox. Or is there a better (more reliable) way to have
    > the link open in a new window/tab (using JS)? I have no control over
    > the JS already on the page - this is for a selenium user extension
    > that I'd like to write.


    You can try using dispatchEvent:

    <URL:
    http://groups.google.com.au/group/c...tchevent winter&rnum=1&hl=en#98cea9cdf065a524
    >


    But it probably won't do what you expect, clicking the scroll wheel is
    not the equivalent of a middle mouse button click[1]. In Firefox, a
    scroll wheel click on a link opens the link in a new tab if
    preferences are set to do that, the link itself never receives the
    click.

    In Safari, a click is sent to the link but you can only send a middle
    button click, which is different to a scroll wheel click, and the link
    is opened in a new window.


    1. You may be able to change preferences for your mouse keys to make a
    scroll wheel click the same as a middle mouse button click, but that
    can't be relied upon.


    --
    Rob
    RobG, Sep 8, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S2V2aW4gQnVydG9u?=

    Pre-Send Request Headers, Pre-Send Request Content

    =?Utf-8?B?S2V2aW4gQnVydG9u?=, Dec 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,031
    =?Utf-8?B?S2V2aW4gQnVydG9u?=
    Dec 31, 2004
  2. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    798
    Kevin Spencer
    May 17, 2005
  3. Nathan Sokalski
    Replies:
    3
    Views:
    1,933
    Larry Lard
    Nov 23, 2005
  4. Chris Reay

    Does Socket.send send all bytes?

    Chris Reay, Nov 3, 2003, in forum: Ruby
    Replies:
    2
    Views:
    210
    Chris Reay
    Nov 4, 2003
  5. pavi
    Replies:
    0
    Views:
    1,323
Loading...

Share This Page