There should be new, optional Markdown syntax to allow a post author to specify that a certain link or type of link should open in a separate tab, such that the reader isn't taken away from the question.
To borrow a quote below from Nathan Tuggy:
The impact of an unwanted new tab is usually a little less than that of an unwanted same-tab navigation.
Three of the prime annoyances with the current behavior that continue to get me (and I know others too):
- Clicking (sometimes inadvertently) on an image or sample code link while I'm in the middle of typing a comment. Since it opens in the same window, when I click back, my in-progress comment is lost.
In the middle of crafting an answer, I often don't notice that new ajax notifications have come in, and in some of those cases, click away, and then come back. I can continue editing my answer no problem, but the ajax notifications are gone (and the items they announced do not appear without a hard refresh), and if I missed them, I could spend a lot of time editing an answer when someone else already provided a decent answer. This has happened to me several times. If clicking back worked predictably (i.e. the ajax notifications were still there, or the new comments/answers just appeared), it wouldn't be so much of a problem.
I sometimes fall into a trap I've seen described elsewhere: I click to a SQLfiddle link provided by an asker, then start making changes, and have to abandon those changes to go back and check some detail from the question. If only all SQLfiddle links automatically opened in a new tab, or if someone had edited in some markdown that made it so, or I weren't so forgetful to force that behavior myself...
In these (and several other cases, described below), I wish that the link could have been specified to open in a new tab.
Other suggestions in the past have asked for all links (or all external links) to open in a new window, by default, without exception and with no user control (author or reader). Even worse, the commonly-targeted duplicate says, almost verbatim:
Please open all links in a new window.
EDIT: Never mind, don't change a thing.
No wonder it is status-declined; it is asking for status quo. That doesn't make it a useful duplicate target.
I'm suggesting that this be made optional, without changing the current and default behavior, for the following sorts of links:
- Images. Like blogs and forums, the post format on SE sometimes makes it difficult to include an image properly demonstrating a problem or solution - I end up doing work in Photoshop to crop/resize/butcher in order to make it fit so that it is readable. I sometimes link to the original in a larger size, but I don't think it's intuitive to launch an image that overtakes the current browser window, requiring a user to click their back button in order to return to the post. Lightbox would be an attractive alternative here, but that wasn't the solution chosen earlier this year.
- Larger code samples. Sometimes users need to post a repro of their problem, and it is easier to host a script file on github or other similar services than to try to put a large script in a post (for database-related posts, for example, sometimes a lot of sample data is required to reproduce a problem). For something someone might ultimately download to run on their own machine, or might just visually inspect, it doesn't make much sense to open that within the same window and lose the context of the post that linked to it.
- Scratchpads. For lack of a better word. There are several services we use where we can play with code samples related to the question or answer, such as Data Explorer, jsfiddle, SQLfiddle, and several others. Similar to the above, it is more intuitive for these to be in a different tab than the post rather than replacing it, since things will often need to be compared side-by-side rather than back, memorize, forward, memorize.
One of the things that prompted me to promote this feature request even though similar, more all-encompassing ones have been denied in the past, is that several of these services did not exist back in 2009 - the way we answer questions has evolved, and continues to evolve.
[link text][newtab] : http://s4.postimg.org/something/something.png
The resulting HTML would have
target=_blank, and should also use
title or other attributes to indicate the behavior for the visually impaired (as per this UX answer).
I have a couple of unresolved thoughts on this request:
I don't know technically how it could be restricted to only these sorts of links; I know we don't want to keep a list of image formats and online services to check against and maintain (though we seem to be okay doing that with things like LMGTFY). I also don't know if this restriction would be necessary up-front just to guard against suspicions of potential abuse, or whether using it for other types of links should even be categorized as abuse (ironically, I'm guarding here against suspicions of potential objections).
I don't know whether there needs to be some visual cue how a link is planning to behave, but if this is determined to be necessary, I'm sure it wouldn't be difficult to do. Microsoft used some globe with an arrow pointing out of it back in the 1990s, but a simpler implementation would be to underline links that launch and not underline links that replace, or vice-versa if the style on the current site is to always underline links.
Yes, users can consciously choose to open a new window using various methods like Ctrl+Click, right-click, etc. But if you're going to scream "don't take my control away from me!" then don't ignore that if you really, really, really want your links to replace the current content instead of opening a new tab, especially if you know that certain types of links will likely do that, you can simply drag the link to the current address bar, which gives you your control right back (on this site and on all other sites that put
target=_blank on all of their links, or even just the external ones).
There was a study done about whether people know how to open a link in a new tab, and I'll spare you the suspense: no they do not. And I suspect the cross-section of those and our audience - especially the steady stream of new users - is not insignificant. The model most web sites have been following for years is that at least external links open in a new tab, precisely because even one audience member might not know how to do that on their own (or may get flustered when they expect to see an image or code snippet in a new window instead of taking them away from the post they were reading). I know we like to be different, but we can't be afraid to try to make the experience a bit better for newer users in certain scenarios, for fear that it would be "too normal."
Now, I know that it is not practical to make this a user option, primarily because of the way the HTML for posts is stored. (It would be prohibitively expensive to store multiple copies of the post to conditionally serve the right one, or to parse and correct all links in all posts at serve time. Caching can prevent some of this, but for active posts I would be nervous about the additional overhead.)
But I also know - and it is clear given the number of times this has come up - that I am not the only person in our community who feels as follows: It is not always the best option to move someone away from the current page to show them certain types of content while they are in the processing of reading or writing a post or testing the answers it contains.
Clearly there is some divide in the community, and this is neither a straightforward "no, no links should ever open in a new tab" nor a "yes, links should always open in a new tab" case:
(Thankfully, I'm not asking for either of those absolutes.)