how to send "click middle mouse button" to link

W

wpollans

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
 
R

RobG

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top