5 ms·
Target="_blank"
I am new around here and I was wondering if anyone has ever suggested setting the links to target="_blank". I realize it is easy to open links in another tab, I just wanted to know why the news section would want to be navigated away from.
- rpicard 13y agoI actually made a Firefox add-on because I wanted to do that. It also does a few other things, but that was the main thing that I wanted. http://robert.io/alter-hn/ http://robert.io/alter-hn/
- unfletch 13y agoI can't speak for HN's motivations, but my view as a web developer has always been that, in general, target="_blank" is bad. My reasoning is twofold: 1) It's unnecessary. Opening a link in a new tab is easy for the user to do with a keyboard modifier, if that's what they want. 2) Worse, when you use target="_blank" you force that behavior on every user. There's no keyboard modifier to negate that behavior and keep the link in the same window.
- ScottWhigham 13y agoOpening a link in a new tab is easy for the user to do with a keyboard modifier Yes, on a desktop or laptop computer. Not so easy on a phone/tablet. I don't think it's bad in the least, not unless it's overused or used improperly. If a "login" link opens a new window, that's obviously poor use. If it's a link along the lines of "view this supporting article that's on another site, then come back here and join the discussion", clearly you want a new window opened - both the author and the reader want that done. Does the target site hijack the "back" button in the browser? Who cares - I've opened a new window/tab and, when I'm done, I'll close it and return to the article I was reading.
- unfletch 13y ago"Yes, on a desktop or laptop computer. Not so easy on a phone/tablet." I've never used Android, but it's dead simple in iOS. Just tap and hold.
- ScottWhigham 13y agoSame in Android.
- tehwebguy 13y agoSort of the opposite in my opinion - you can tap + hold on iOS but closing a window and going back to the previous one is way more of a pain than cmd + w on my computer.
- wikwocket 13y agoAlso, it breaks the back button. However, there are use cases for it. It really depends on the application, the use case, and the target audience.
- Sealy 13y agoMiddle clicking on a link brings it up in a separate tab. If your mouse does not have a middle click button, buy one. It is a godsend. If not, re-map one of your mouse buttons to be a Button-3. I often remap the forward button to Button 3. How often would you want to go forward to a page after you've gone back?
- ScottWhigham 13y agoI don't know why the top two comments here assume that everyone browsing is using a mouse. Many of us use a phone/tablet.
- mkr-hn 13y agoI didn't even know mobile browsers supported tabs. I would have assumed a desktop or laptop too.
- ScottWhigham 13y agoI've used the iPhone 3G+, HTC One, and Samsung Galaxy S4 and they all have tab-based browsing. The Chrome browser even prompts you to "Open in new tab?" if you long-click a link.
- deleted 13y ago[deleted]
- matt_ 13y agoYou don't need to remap or buy a new mouse, ctrl+click opens in a new tab as well.
- dm2 13y agoAlso, middle clicking a tab closes it, which is handy.
- brudgers 13y agoWhy did the chicken navigate away from the news page? To get to the comments.
- RiderSargent 13y agoIf you use Greasemonkey, you can use the following user script (only adds the target attribute to article links): // ==UserScript== // @grant none // @match https://news.ycombinator.com/* // @name Hacker News Tweeks // @namespace https://github.com/ridersargent // @require http://code.jquery.com/jquery-latest.js // ==/UserScript== $(document).ready(function() { // set article-related links to open in new window/tab $('.subtext a, .title:not(:last) a').attr('target', '_blank'); });
- ColinWright 13y agoOddly enough, this has been suggested, and discussed, several times in the past. Here is a selection: https://news.ycombinator.com/item?id=516933 https://news.ycombinator.com/item?id=516933 https://news.ycombinator.com/item?id=1621892 https://news.ycombinator.com/item?id=1621892 https://news.ycombinator.com/item?id=1866268 https://news.ycombinator.com/item?id=1866268 https://news.ycombinator.com/item?id=2111082 https://news.ycombinator.com/item?id=2111082 https://news.ycombinator.com/item?id=2353291 https://news.ycombinator.com/item?id=2353291 https://news.ycombinator.com/item?id=2469065 https://news.ycombinator.com/item?id=2469065 https://news.ycombinator.com/item?id=3560941 https://news.ycombinator.com/item?id=3560941 https://news.ycombinator.com/item?id=3695029 https://news.ycombinator.com/item?id=3695029 https://news.ycombinator.com/item?id=4880204 https://news.ycombinator.com/item?id=4880204 https://news.ycombinator.com/item?id=5085659 https://news.ycombinator.com/item?id=5085659 https://news.ycombinator.com/item?id=5284186 https://news.ycombinator.com/item?id=5284186 https://news.ycombinator.com/item?id=5919030 https://news.ycombinator.com/item?id=5919030 https://news.ycombinator.com/item?id=5966176 https://news.ycombinator.com/item?id=5966176
- pasbesoin 13y agoThere are bookmarklets (or write your own) that will parse page source and modify links to this.