3 ms·
I particularly hate when someone does things like (1) <a href="navigateToFoo()"> when it should be <a href="foo.htm"> so I can't middle click it or Ctrl
by jakub_g 13y ago
I particularly hate when someone does things like (1)
<a href="navigateToFoo()">
when it should be
<a href="foo.htm">
so I can't middle click it or Ctrl-click it to open in a new tab. Even worse if there's (2)
href="#"
added, which upon middle click will happily load the page I'm currently on inside the new tab.
I have an extension in Firefox which changes the mouse cursor for (1) from pointer (hand), so I can easily distinguish that case, I hope this became a W3C standard somehow (though the standard way for executing JS are buttons, not anchors, so probably it won't ever become standardized).
- jakub_g 13y ago*should have been <a onclick="navigateToFoo()">
- derefr 13y agoI'm surprised that no browser has done the obvious yet: treat middle-clicking a DOM element with a bound onclick handler the same as left-clicking that DOM element, but override window.open and window.location.redirect within the context of that handler call to open links in a new tab instead.