473,770 Members | 7,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to send "click middle mouse button" to link

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

Sep 7 '07 #1
2 6977
On Sep 8, 5:53 am, wpollans <wpoll...@gmail .comwrote:
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/co...cea9cdf065a524
>
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

Sep 8 '07 #2
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.
Thanks,
Warren
A few ways:
1. you can open a window via window.open method; the open method is as
follows: open (URL, windowName[, windowFeatures]).
2. you may designate a div to which you render the response from setting
the src of a hidden iframe; the rendering is done by replacing the
innerHTML of the div.
3. you may use AJAX method to get the contents of you wish to render,
and when you get the response render into div via innerHTML replacement.

Note that in the case of the divs you may even make these divs popup by
setting their position.

Sep 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7214
by: Kurda Yon | last post by:
Sorry for a very stupid question. Can you tell me what does the following html source does if I press button "Send"? If I read this code by Netscaspe from my local file system and then press "Send", I see in my browser directory where the considered html source is located. If I publish the given html source, open published page and again press "Send" nothing changes... What I want to do, is to know what choice did people who were visiting...
0
302
by: Yoni Rapoport | last post by:
Hy everyone, just wanted to share a thought regarding UI. If you really think about it, events such as "Click", "DoubleClick", "KeyDown", "KeyUp", etc... (which clutter every winforms control we see) are mostly annoying and sometimes even harmful. How does knowing a control was clicked by the mouse (and how many times it was clicked) help a client object know what the user intended to do by that action? How many times have you found...
1
1665
by: Bob Alston | last post by:
I am trying to highlight required data fields in a continuous form situation. Got it working for all but date fields. For date fields, I am trying setting default date to -1 (=12/29/1899) and then using this format: mm/dd/yyyy ;" Missing Date" Shows words "missing Date" for the default value. And if a good date is entered, the field displays with black text. What I want to do is make it easy to fix missing dates. Now, If i click
0
1386
by: Quentin Huo | last post by:
Hi: In my page, there is a user control and there are some actions in the user control like "save", "delete",...which are the control <asp:button onclick="btSave_Click" ......>. And there are several links in the page which are <a href="....."> and go to other pages. I got an error " The page cannot be displayed........" whenever I did as followed:
0
1680
by: Per Larsson | last post by:
I have been nagging for help on this subject for quite some time now. Finally got it sorted out by my self. Here is the code if some one else ever need it. 'Declarations: Declare Function GetWindowLong Lib "user32" _ Alias "GetWindowLongA" _ (ByVal hwnd As System.IntPtr, ByVal nIndex As Integer) As Integer
7
10885
by: the_grove_man | last post by:
How do I invoke a "Right-Click" Programmtically? John
8
4634
by: Chaitanya | last post by:
Hello, In my Application i want to know when user clicks both the "Left" and "Right" buttons of the Mouse. I am getting a number like this "3145728". But the MouseButtons Enum contains only Left, Right, Middle, None, XButton1 and XButton2. I am using .NET 1.1 version. How can i convert "3145728" to MouseButtons Enum? why Mouse Left+Right click not added to the Enum? Can anyone help me?
33
2394
by: STILL LEARNING | last post by:
I'm not sure if this can even be done, but what prompts the question is my desire to be able to create an "Uber Link" script/code of some sort, such that even if the html page contains nothing but a background image -or- a background color -- in other words, the page has neither content nor placed images -- any click, ANYWHERE, will launch the URL in your browser. I realize I can make traditional text links and graphics links; what I'm...
2
3657
by: JDeats | last post by:
Using VS.NET 2005, if you place a WinForms WebBrowser control on a form, then place a command button on that form and in the "click" even handler for the command you do: webBrowser1.DocumentText = ""; On every mouse click you were hear a "click" sound identical to the sound Internet Explorer makes as it navigates from one site to the next. If you're getting creative with the webBrowser control this is quite annoying.
0
9592
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10004
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.