20
3
Sometimes while browsing, I'll ctrl-click a link to open it in a new tab. However, instead of opening in a new tab, it gets clicked and browsed to in the current tab as if I had clicked it normally without holding ctrl. I'm positive I'm holding ctrl down fully and that there is no faultiness with keyboard or mouse.
Occasionally, a new tab will be opened with the link but the current tab will also browse to the link concurrently.
3
Perhaps they are not actual links, in the sense that maybe the "link" is using an
– imtheman – 2014-12-20T00:30:23.100onclick
operation which could mess with the ctrl+click. Can you give a specific example? http://meta.stackoverflow.com/questions/276138/ctrlclick-and-shiftclick-do-not-open-new-tabs-windows-in-search-results@imtheman Great point, however, it doesn't appear to be the case, at least in the examples I've seen. I know this because I always hover my mouse over the link beforehand to verify that it's showing a URL in the status bar. An example is here: http://www.nationaljournal.com/white-house/the-new-white-house-fence-could-wind-up-being-really-really-tall-20141218
In the lefthand column/bar, the links to other stories appear to be their own URLS, verified by even jumping to their location in the source, however, ctrl-clicking doesn't work, instead acting as if ctrl isn't being held.
If you look at the source code for that site you'll see this for one of the links:
<a class="primary" href="/congress" onclick="var x=".tl(";s_objectID="http://www.nationaljournal.com/congress_1";return this.s_oc?this.s_oc(e):true">Congress</a>
– imtheman – 2014-12-29T17:55:23.3531While it does have an
href
attribute, it is overwritten by the onclick event. – imtheman – 2014-12-29T17:56:36.280Aha! Thanks. So I guess this means that the browser's status-bar display of the hovered-over URL displays the link "post-Javascript", but ctrl-clicking the link essentially executes as "pre-Javascript" (so to speak) -- does that sound right? – Coldblackice – 2014-12-29T18:05:56.987
Not quite. I'll post answer to explain a little better. – imtheman – 2014-12-29T18:13:05.287
1
I wrote a Firefox addon to fix this issue. https://github.com/danielnixon/link-fixer
– danielnixon – 2018-03-07T08:17:44.513Voting for this bug should help (and it's really easy): Bug 55696 - "Force JavaScript link to open in new window or new tab"
– braham-snyder – 2019-06-07T13:55:46.070