-4

jsFiddle is frequently used in web design questions to provide examples of working or non-working code.

Because links open by default in the same window/tab you're currently using, quite often I'll view the query, close the tab, and lose the question.

Obviously this isn't hard to remedy on a case by case basis, but is there an argument for SO detecting jsFiddle links and automatically setting the target to "_blank"? It's almost always the case that I'll want to have both the fiddle and the question open at the same time.

3
  • dup-closed duplicate on parent meta: meta.stackexchange.com/questions/199436/…
    – Vogel612
    Nov 6, 2014 at 8:58
  • 2
    They refuse to do this. Try to remember to ctrl-click. If you close the tab, hit ctrl-shift-T, which reopens the last tab, including history. You can then hit the back arrow.
    – user1228
    Nov 6, 2014 at 18:50
  • I just wanted to ask the same question but as I see there are already some. I find it would be very usefull if you could set it in your settings like for every search engine that I know.
    – t3chb0t
    Jan 16, 2015 at 21:55

2 Answers 2

11

Just configure your browser to open links in new tabs / windows.

This is not something that should "configured" site-side.

A few simple alternatives would be:

  • Do you have a mouse with a scroll wheel? Click that wheel on the link, it opens the link in a new tab.
  • Press Ctrl and click a link.(Opens the link in a new tab in the background.)
  • Press Ctrl+Shift and click a link. (Opens the link in a new tab and switches to the newly opened tab.)
  • Press Shift and click a link. (Opens the link in a new window.)
11
  • 1
    But it's not something I'd always want to happen... Nov 6, 2014 at 8:51
  • 1
    It's not something I'd always even want to happen on SO with anything other than jsFiddle - when navigating between questions, for example, I'm very happy to keep things in one tab. Nov 6, 2014 at 8:52
  • Yes, as I said, it's easy to remedy on a case-by-case basis, I'm talking about a permanent fix. Nov 6, 2014 at 8:54
  • 9
    Different users have different preferences. There is really no good reason to make fiddle links behave differently from all other links on the site.
    – Cerbrus
    Nov 6, 2014 at 8:55
  • 1
    @Cerbrus Of course, ctrl-click may not work for a while
    – DavidG
    Nov 6, 2014 at 9:57
  • 1
    It's a really poor answer. Why don't just let us to decide ourselves what is better for us in the settings? Just like google has it or any other search engine for example.
    – t3chb0t
    Jan 16, 2015 at 21:53
  • 1
    @t3chb0t: This "Really poor answer" is currently at +9 votes. "Open page at..."- functionality like this should really not be determined by the site, simply because there is no reliable way to do so. If you disagree with an answer, it doesn't make that answer a "poor" one.
    – Cerbrus
    Jan 16, 2015 at 21:56
  • 1
    Yes with two downvotes (one is mine). There isn't? And what happened to the old target="_blank"? If we had an option in the settings open links in posts in new tab the script could just add this attribute to a link. You could ask a question on SO how to do it ;-)
    – t3chb0t
    Jan 16, 2015 at 22:01
  • Browsers can easily be configured to ignore target="_blank". I repeat: "there is no reliable way to do so". Two downvotes versus 11 upvotes. Still doesn't quite seem to qualify as "Poor".
    – Cerbrus
    Jan 16, 2015 at 22:03
  • 1
    Hehe ;-) there is no reliable solution for anything. Someone can just disable JavaScript and nothing would work either. If there is someone who decides to ignore the target attribute he probably won't set it in the setting to use it. It doesn't have to be for every one. You are calculating hundreds of uncecessary statistics and implement one million silly badges but fail in making such a basic functionality ;-|
    – t3chb0t
    Jan 16, 2015 at 22:07
  • the trouble with this is that I constantly want to do this but it's a generally unusual interaction - so I think a good exception to Nielson's rule - if it was an unusual action I'd agree this was the best way forward. all in all, I actually think a user-configurable variable would be the nicest solution
    – Toni Leigh
    Jun 17, 2015 at 17:04
-2

For those who are still interested in opening links in new tabs I've created a tiny script that does that in Chrome and the new Opera with Tempermonkey:

// ==UserScript==
// @name         StackOverflow Link Tuner
// @namespace    http://www.stackoverflow.com/
// @version      0.1
// @description  Opens QA links in a new tab
// @author       t3chb0t
// @match        http://stackoverflow.com/questions/*
// @grant        none
// ==/UserScript==

var postLinks = $('div.post-text a');
postLinks.attr('target', '_blank');

It works both for questions and answers but not for comments (yet?).

Version for optimizers and hardcore debuggers:

// ==UserScript==
// @name         StackOverflow Link Tuner
// @namespace    http://www.stackoverflow.com/
// @version      0.1
// @description  Opens QA links in a new tab
// @author       t3chb0t
// @match        http://stackoverflow.com/questions/*
// @grant        none
// ==/UserScript==

$('div.post-text a').attr('target', '_blank');
4
  • 2
    Why would you assign the jquery object to a temporary variable? And you could just configure your browser to open links in a new tab in the first place. Besides, this won't work for any link that got added to the page after page load (New answers / comments, edited posts, to name a few)
    – Cerbrus
    Jan 16, 2015 at 22:32
  • Why not? For debugging purposes of course. Everyone who has some experience does it ;-) ... and I don't want to open all links every time in a new page but just those.
    – t3chb0t
    Jan 16, 2015 at 22:35
  • @Cerbrus are you in the SO team developing the website or are just a casual user?
    – t3chb0t
    Jan 17, 2015 at 9:44
  • 1
    If I were a SO dev, it'd say that on my profile.
    – Cerbrus
    Jan 17, 2015 at 9:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .