5 ms·
LinksOnHN[n].setAttribute('target',"_blank");
As of dec 21 ,2008 - clicking on stories in HN,open them in the same tab. An average visit to HN involves for me, 10 (right clicks + click ) combo's (on my laptop )
would it help to add a target="_blank" attributes for story links, so that they open in new tabs/windows
( edit: and the tab with HN links remains intact )
this also works out well for those who prefer using the keyboard to navigate links in a page. ( yup, vi/emacs does that to ppl ! )
~B
tags: [accessibility]
- jgalvez 18y agoWell, since middle click has the same behavior even with @target="_blank", I couldn't care less if they enabled it or not.
- river_styx 18y agoPlease don't make this change. My #1 pet peeve on the web is a page that opens new browser windows.
- daleharvey 18y agojust curious, why? I mean this isnt 5 years ago and sites are opening obtrusive windows that fill up the taskbar and ruin your history
- river_styx 18y agoIt's just annoying. If I want to open a new window, I'll do that myself by cmd-clicking or some variant of that.
- clint 18y agoCorrect. Best practices are that you do not force your users into any particular browsing habit. Keep it consistent and do not open things in _blank that do not absolutely require it. There are a million tools for users to control their browsing experience ... in the browser. Do not force it in your application.
- cabalamat 18y ago> Best practices are that you do not force your users into any particular browsing habit. Agreed. Is there a plugin in Firefox that ignores target directives and does it the way I want?
- Zak 18y agoTry Tab Mix Plus https://addons.mozilla.org/en-US/firefox/addon/1122 https://addons.mozilla.org/en-US/firefox/addon/1122 It has a whole bunch of features, one of which is to force all links to open in the current tab.
- diN0bot 18y agomaybe it could be a preference. i personally run a greasemonkey script that not only opens links in a new tab, but inserts a topbar so i can vote and get to comments from the article page.
- jackowayed 18y agoFirst thing I thought was "greasemonkey" when I read this. But the extra features of your script sound pretty sweet. Is it online somewhere?
- ardell 18y agoTry Hacker News OnePage for Greasemonkey. I love it so far. http://userscripts.org/scripts/show/30512 http://userscripts.org/scripts/show/30512
- RossM 18y agoI agree. I use the scroll button to open links in new tabs, but sometimes I really want to open a page in the same tab. This is only seconded by links that are something like: <a href="javascript:void(0);" onclick="someStuff();"> I sure do love opening a tab for javascript:void(0).
- eelco 18y agoNow would be a great time to learn the joy of mouse gestures, configure your middle click button or install a greasemonkey/userscript.
- schtono 18y agoMake it optional per user :)
- windsurfer 18y agoThis is such a niche feature that I think it would bloat the options pane. This is also a perfect job for greasemonkey :)
- daleharvey 18y agoI dont think its niche, it seems like the core use case is opening the site and reading through a pick of the front page articles, in that case opening in a new window saves either half the clicks, or having to press back all the time (as long as the article isnt interesting enough to click through further)
- windsurfer 18y agoYou complain about having to perform some arcane action to open a new tab, but in most operating systems, if you press left+right mouse buttons at the same time, it is interpreted as a middle-click. Also, in firefox, ctrl+enter opens a highlighted link in a new tab while keeping the current tab open. ctrl+shift+enter to open and focus the new tab.
- iron_ball 18y agoFor the other three Opera users on HN, it's the same behavior but reversed: shift-click (or shift-enter if you use shift-arrow navigation) opens in a focused new tab; ctrl-shift-click opens the new tab but sends it to the background for later.
- bosky101 18y agodoh! ctr+enter opens a terminal for a lot of developers :) i agree middle button works out best, but that said - a lot of laptop users also dont carry a spare mouse, and "trying to click left and right" on the laptop sort of breaks the flow. other advantages? ... keeps the index of HN links on one tab the whole day,links opens in new tabs. it's also a question of "can i eliminate the need of a mouse"
- daleharvey 18y ago15 key presses to open the top story in a new window? ctrl+shift+press link does the same, but is pretty much as inconvenient than right click -> open in new tab
- markessien 18y agoThis is a problem YOU have, it's not a problem with the website. So fix it for yourself, there are many ways to do so.
- russell 18y agoNo. I can already do it with my mouse. I have no desire for site specific short cuts.
- cabalamat 18y agoI agree. Site specific short cuts are worse thasn useless, because you'd have to use different ones for each site.
- jey 18y ago"this also works out well for those who prefer using the keyboard to navigate links in a page. ( yup, vi/emacs does that to ppl ! )" I am a keyboard junkie and I have no problem with Hacker News. I just use the amazing Vimperator extension which adds vim keybindings to Firefox. So to open a link in a new tab I just press "F" to activate quickhints, which displays a number beside each link, then I type the number of the link I want. (Or I can type some text that is contained in the <a> tag). http://vimperator.org http://vimperator.org Ultimately this is a browser UI issue, not a Hacker News issue.
- albertcardona 18y agoIn firefox, middle-click will open a new tab.
- derefr 18y agoAs will holding Control while you click.
- kirubakaran 18y ago1. Ctrl-Click or the equivalent for your browser. 2. http://userscripts.org/scripts/show/36606 http://userscripts.org/scripts/show/36606 There are other Greasemonkey scripts like this. 3. https://addons.mozilla.org/en-US/firefox/addon/379 https://addons.mozilla.org/en-US/firefox/addon/379 There are other extensions like this. 4. Write your own ff extension or gm script. 5. Just use backspace or Alt-LeftArrow.
- ideamonk 18y agoI use ctrl+click, works for me and firefox :P
- eisokant 18y agoSame here
- mihasya 18y agoMiddle click FTW!
- durbin 18y agoi'd love it if hn added a simple checkbox like techmeme to open links in a new tab. The middle click is pretty sweet though.
- mdasen 18y agoOn Windows you can use control+click and on a Macintosh you can use command+click.
- Eliezer 18y agoAll hail the QuickDrag Firefox extension. Just grab the link and throw it; no keyboarding involved, or trying to press down on the scroll wheel.
- deleted 18y ago[deleted]
- andreyf 18y agoTry clicking both of your mousekeys on your laptop at the same time (put your finger in the middle). With some drivers, this simulates a middle-key-click (opens in a new tab)
- bdittmer 18y agoWhy not just write a GreaseMonkey script to do this? Simple enough...
- ComputerGuru 18y agoNo.
- cabalamat 18y agoIf I want to open a link in a new tab, I click it using the middle mouse button. This works on Firefox on Ubuntu. On your browser/OS combination there is probably something similar; if not, I suggest you upgrade the software you're using.
- kwamenum86 18y agoImplementing this option (as an official HN feature) could be done entirely in Javascript (meaning no need to worry about building more shit into the server) and completed in under an hour. It would be cool if there were an "HN Labs" that suggested feature submissions and allowed users to add them to their accounts as profile extensions. Setting up HN links with _blank is also a trivial solution to implement on your own though.
- arjunb 18y agoAnother way you can hack this yourself - get FluidApp, and make HN a site-specific web app. All off-site links will automatically spawn in new browsers.