FireFox Click Wheel does not fire onclick Event

May 08, 2006

I just noticed something today in Firefox (on Windows, probably the same on Mac haven't tested yet). Suppose you have a link with a JavaScirpt onclick event such as:

<a href="deleteTB.cfm" onclick="javascript:return confirm('Are you sure?');">delete</a>

If you click this link with the left mouse button the JavaScript is executed. If you click with the scroll wheel the event is not fired. This is a fairly common thing for a FireFox user to do since you can open links in new tabs by clicking on links with the scroll wheel.

Like this? Follow me ↯

You might also like:

6 people found this page useful, what do you think?


I think this is a good thing! I use it all the time to bypass JavaScript confirmation dialogs.
Bug or feature? You decide :)
I think it's a feature. If you wanted to execute the JS you could right-click and choose "Open in a new tab" instead of middle-clicking.
It's the way it should be, The js can-not be opened in a new page. A web designer needs to create an alternative way of accessing the site without js. That why the href should always be there. Middle click should open a new tab. In case there is no real link the js can't open in a new page anyway. Sites that do open the js as if it's an url are just coded badly. &lt;a href="javascript:popup()"&gt;like this&lt;/a&gt; I do agree, it would be more logical for a browser to support onmiddleclick= and target="new_tab"
I am looking for a way around this because I have my button behavior reversed so that left-click opens tabs (my default) and middle click keeps me in the same page. When I use a web app that has a mix of plain and javascript links, I have to learn which are which so I know how to navigate properly. Annoying, but surprisingly learnable. Still, I would love to get the javascript triggered on middle click if I have this behavior setup. (I use Tab Mix Plus for this)

Foundeo Inc.