News for hackers. Stuff that matters.

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]

( 41 comments | 9 points | on HN )
Re:LinksOnHN[n].setAttribute('target',"_blank"); by river_styx on Sunday December 21, 2008 @12:41PM (#405518)
Please don't make this change. My #1 pet peeve on the web is a page that opens new browser windows.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by diN0bot on Sunday December 21, 2008 @02:36PM (#405646)
maybe 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.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by jackowayed on Sunday December 21, 2008 @05:26PM (#405788)
First thing I thought was "greasemonkey" when I read this. But the extra features of your script sound pretty sweet. Is it online somewhere?
Re:LinksOnHN[n].setAttribute('target',"_blank"); by ardell on Sunday December 21, 2008 @10:14PM (#406019)
Try Hacker News OnePage for Greasemonkey. I love it so far.

http://userscripts.org/scripts/show/30512

Re:LinksOnHN[n].setAttribute('target',"_blank"); by RossM on Monday December 22, 2008 @07:44AM (#406322)
I 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).

Re:LinksOnHN[n].setAttribute('target',"_blank"); by daleharvey on Sunday December 21, 2008 @01:11PM (#405548)
just curious, why?

I mean this isnt 5 years ago and sites are opening obtrusive windows that fill up the taskbar and ruin your history

Re:LinksOnHN[n].setAttribute('target',"_blank"); by river_styx on Sunday December 21, 2008 @01:17PM (#405553)
It's just annoying. If I want to open a new window, I'll do that myself by cmd-clicking or some variant of that.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by clint on Sunday December 21, 2008 @02:10PM (#405619)
Correct. 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.

Re:LinksOnHN[n].setAttribute('target',"_blank"); by cabalamat on Sunday December 21, 2008 @03:56PM (#405711)
> 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?

Re:LinksOnHN[n].setAttribute('target',"_blank"); by Zak on Sunday December 21, 2008 @05:21PM (#405782)
Try Tab Mix Plus

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.

Re:LinksOnHN[n].setAttribute('target',"_blank"); by jey on Sunday December 21, 2008 @01:10PM (#405545)
"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

Ultimately this is a browser UI issue, not a Hacker News issue.

Re:LinksOnHN[n].setAttribute('target',"_blank"); by RossM on Monday December 22, 2008 @07:47AM (#406323)
While I'm not a Vim user (or even an emacs user) that sounds useful without the knowledge of Vim keyboard shortcuts.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by jey on Monday December 22, 2008 @12:28PM (#406582)
Knowledge of vim is not required but helps; the manual is pretty thorough.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by bosky101 on Sunday December 21, 2008 @01:16PM (#405552)
hey, thanks for the tip...
Re:LinksOnHN[n].setAttribute('target',"_blank"); by markessien on Sunday December 21, 2008 @01:03PM (#405539)
This 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.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by eelco on Sunday December 21, 2008 @12:42PM (#405520)
Now would be a great time to learn the joy of mouse gestures, configure your middle click button or install a greasemonkey/userscript.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by russell on Sunday December 21, 2008 @01:06PM (#405542)
No. I can already do it with my mouse. I have no desire for site specific short cuts.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by cabalamat on Sunday December 21, 2008 @03:51PM (#405702)
I agree. Site specific short cuts are worse thasn useless, because you'd have to use different ones for each site.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by windsurfer on Sunday December 21, 2008 @12:54PM (#405529)
You 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.

Re:LinksOnHN[n].setAttribute('target',"_blank"); by iron_ball on Sunday December 21, 2008 @12:57PM (#405532)
For 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.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by daleharvey on Sunday December 21, 2008 @01:03PM (#405538)
15 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

Re:LinksOnHN[n].setAttribute('target',"_blank"); by bosky101 on Sunday December 21, 2008 @01:01PM (#405536)
doh! 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"

Re:LinksOnHN[n].setAttribute('target',"_blank"); by ideamonk on Sunday December 21, 2008 @01:22PM (#405560)
I use ctrl+click, works for me and firefox :P
Re:LinksOnHN[n].setAttribute('target',"_blank"); by eisokant on Sunday December 21, 2008 @01:26PM (#405568)
Same here
Re:LinksOnHN[n].setAttribute('target',"_blank"); by mihasya on Sunday December 21, 2008 @01:25PM (#405565)
Middle click FTW!
Re:LinksOnHN[n].setAttribute('target',"_blank"); by durbin on Sunday December 21, 2008 @03:06PM (#405673)
i'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.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by bdittmer on Sunday December 21, 2008 @01:46PM (#405591)
Why not just write a GreaseMonkey script to do this? Simple enough...
Re:LinksOnHN[n].setAttribute('target',"_blank"); by kirubakaran on Sunday December 21, 2008 @01:18PM (#405555)
1. Ctrl-Click or the equivalent for your browser.

2. http://userscripts.org/scripts/show/36606 There are other Greasemonkey scripts like this.

3. 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.

Re:LinksOnHN[n].setAttribute('target',"_blank"); by kwamenum86 on Sunday December 21, 2008 @07:45PM (#405918)
Implementing 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.

Re:LinksOnHN[n].setAttribute('target',"_blank"); by cabalamat on Sunday December 21, 2008 @03:53PM (#405705)
If 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.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by schtono on Sunday December 21, 2008 @12:42PM (#405521)
Make it optional per user :)
Re:LinksOnHN[n].setAttribute('target',"_blank"); by windsurfer on Sunday December 21, 2008 @12:50PM (#405527)
This is such a niche feature that I think it would bloat the options pane. This is also a perfect job for greasemonkey :)
Re:LinksOnHN[n].setAttribute('target',"_blank"); by daleharvey on Sunday December 21, 2008 @01:10PM (#405546)
I 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)
Re:LinksOnHN[n].setAttribute('target',"_blank"); by andreyf on Sunday December 21, 2008 @01:43PM (#405586)
Try 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)
Re:LinksOnHN[n].setAttribute('target',"_blank"); by arjunb on Sunday December 21, 2008 @11:34PM (#406076)
Another 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.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by Eliezer on Sunday December 21, 2008 @01:36PM (#405577)
All hail the QuickDrag Firefox extension. Just grab the link and throw it; no keyboarding involved, or trying to press down on the scroll wheel.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by jgalvez on Sunday December 21, 2008 @09:30PM (#405990)
Well, since middle click has the same behavior even with @target="_blank", I couldn't care less if they enabled it or not.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by mdasen on Sunday December 21, 2008 @01:26PM (#405567)
On Windows you can use control+click and on a Macintosh you can use command+click.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by ComputerGuru on Sunday December 21, 2008 @02:58PM (#405669)
No.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by albertcardona on Sunday December 21, 2008 @01:18PM (#405554)
In firefox, middle-click will open a new tab.
Re:LinksOnHN[n].setAttribute('target',"_blank"); by derefr on Sunday December 21, 2008 @04:04PM (#405720)
As will holding Control while you click.