Ask HN: Why do links open in the same tab on Hacker News?
Why do links open in the same tab on HN? I would love to be able to just click five interesting links and have five new tabs open.
14 comments
A user script using Greasemonkey for Firefox or TamperMonkey for Chrome/Chromium can change the behavior. For example:
Greasemonkey: https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
Tampermonkey: https://chrome.google.com/webstore/detail/tampermonkey/dhdgf...
// ==UserScript==
// @name add_target_blank
// @namespace com.kludgecode.demonstration
// @include https://news.ycombinator.com/news
// @version 1
// @grant none
// ==/UserScript==
var stories=document.getElementsByClassName("storylink");
for (story of stories) {
story.target = "blank";
};
Will add the behavior for the Hacker News front page. I tested with Greasemonkey and I'd expect it to work for Tampermonkey.Greasemonkey: https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
Tampermonkey: https://chrome.google.com/webstore/detail/tampermonkey/dhdgf...
That's the default on pretty much every site (google, reddit, etc). Instead, you can cmd/ctrl click the link.
I understand it's the default, but why? Why not add `target="_blank"` or some javascript to open in a new tab?
Aside from what detaro said, also this:
https://medium.com/@jitbit/target-blank-the-most-underestima...
https://medium.com/@jitbit/target-blank-the-most-underestima...
I just Ctrl-click when I want it in a new tab. Always expect a single click to open in the current tab, otherwise it's an annoying surprise.
It's possible that it's a security thing. I consider it a feature. `window.opener` can do things that might be considered malicious.
I use this Chrome plugin to open links to any external site in a new tab
https://chrome.google.com/webstore/detail/open-external-link...
https://chrome.google.com/webstore/detail/open-external-link...
I asked this a while back as well. I'm with you, but the community seems rather split on the subject.
Use Chrome, install the Vimium plugin: F + {Letter Combo}
ctrl (or command) click does the trick, but for me it's easier to just middle-click with the mouse (or click the wheel).