Project

General

Profile

Actions

Feature #3801

closed

Links to external pages should get a target="_blank" attribute

Added by Roderik van der Veer over 14 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Text formatting
Target version:
-
Start date:
2009-09-01
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate

Description

When using links in the descriptions of bugs (happens a lot if you use redmine for web projects), the automatic link replacer should add a target="_blank" to these links. Because while you want to go and view these links, you still need the tickets and redmine system as well.


Related issues

Is duplicate of Redmine - Feature #1151: Open Links in New-WindowNew2008-05-01

Actions
Actions #1

Updated by Ewan Makepeace over 14 years ago

I dont get it - surely you just ctrl-click (or whatever your browser needs) to open all the linked pages in new tabs? I think explictly setting the target could have nasty side effects from time to time, and give me no real convenience?

Actions #2

Updated by Roderik van der Veer over 14 years ago

My problem with external links is that while following the links from a redmine ticket, the context of the ticket is gone unless you press your back button a few times, or you enter the redmine url again and look for the ticket again.

While you might be correct to assume there might be some other consequences a lot of intermediate solutions are available, see this acticle: http://www.sitepoint.com/article/beware-opening-links-new-window/

The icons is also the way sites like wikipedia handle external links.

Actions #3

Updated by Anonymous over 14 years ago

+1 on _blank ( or config option )

Actions #4

Updated by Adam Piotr Żochowski over 14 years ago

Ctrl-click doesn't work on all browsers:
  • Chrome : ctrl-click
  • Firefox : ctrl-click
  • Opera : ctrl-shift-click
  • IE : shift-click

Alternatively, there is also the middle-click.

No self respecting site, that I know, does this to its users. Please refer to see how wikipedia, google, slashdot and even smaller sites like digg/reddit work. Neither open new windows.

Actions #5

Updated by Henrik Ammer over 14 years ago

Roderik van der Veer wrote:

My problem with external links is that while following the links from a redmine ticket, the context of the ticket is gone unless you press your back button a few times, or you enter the redmine url again and look for the ticket again.

While you might be correct to assume there might be some other consequences a lot of intermediate solutions are available, see this acticle: http://www.sitepoint.com/article/beware-opening-links-new-window/

The icons is also the way sites like wikipedia handle external links.

I agree that PDFs etc that should be downloaded should open in a new window but with obfuscated URLs, how do we tell them apart? For instance, a bit.ly link can link to a PDF or a webpage and there is no way of knowing.

Anything else is up to the user to choose. If I want a new window (or rather tab for that matter) I middleclick in Firefox and I have it, if I wish to leave the site and read on I just click the link. Don't force me to see new windows/tabs when I click external links if I don't want to, it's just bad practice and will get the users blood boiling.

My $.02

Actions #6

Updated by Olivier Farlotti over 13 years ago

While i understand you, the fact is that is damageable for users that don't want _blank link since they can't get the original behavior of the link back.

More over it's not considered as a good practice by W3C for accessibility et usability purpose

Actions #7

Updated by Matt N over 12 years ago

+1 for allowing a config. While users can do extra clicks, it's not necessarily convenient. Besides, Redmine makes uses of this in things like help.

Under Chrome:
Help->Text Formatting : brings up a popup
Help->Text Formatting->More Information : brings up a new tab from the popup

Actions #8

Updated by Mischa The Evil over 12 years ago

Matt N wrote:

[...] Besides, Redmine makes uses of this in things like help.

Under Chrome:
  • Help->Text Formatting : brings up a popup
  • Help->Text Formatting->More Information : brings up a new tab from the popup

True, but the textformatting "help" link is different since there is a specific need to open these links in other popups/tabs. You can't compare these two things IMHO.

Actions #9

Updated by Matt N over 12 years ago

Agreed, but we're also making (incorrect) presumptions, by not allowing these action, that folks won't have specific needs themselves to open their links in other tabs.

Actions #10

Updated by Rob C almost 12 years ago

I would really like this feature. External links should open in a new window (or best case it would be a setting I could enable).

Actions #11

Updated by Filou Centrinov about 11 years ago

+1

Actions #12

Updated by Daniel Felix about 11 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Closing this as duplicate of #1151.

Actions #13

Updated by Filou Centrinov about 11 years ago

Fix:

/lib/redcloth3.rb

- external = (url =~ /^https?:\/\//) ? ' class="external"' : ''
+ external = (url =~ /^https?:\/\//) ? ' class="external" target="_blank"' : ''

/lib/redmine/wiki_formatatting.rb

- %(#{leading}<a class="external" href="#{ERB::Util.html_escape href}">#{ERB::Util.html_escape content}</a>#{post}).html_safe
+ %(#{leading}<a class="external" target="_blank" href="#{ERB::Util.html_escape href}">#{ERB::Util.html_escape content}</a>#{post}).html_safe

Add this to your Stylesheets:
/public/stylesheets/application.css

a.external {
  background-position: 0% 60%;
  background-repeat: no-repeat;
  padding-left: 12px;
  background-image: url(../images/external.png);
}

Actions #14

Updated by Filou Centrinov about 11 years ago

Alternative without changing system:
Add the following code at the end of /public/javascripts/application.js

function addTargetExternalLinks() {
  $('a.external').each(function() {
    $(this).attr('target','_blank');
  });
}

$(document).ready(addTargetExternalLinks);

Actions #15

Updated by Samuel Suther over 9 years ago

This is still not implemented in the Core till now.
Would be gread if Redmine had this feature out of the Box!!!

Actions #16

Updated by Miroslav Zaťko almost 9 years ago

+1
Would be great if Redmine had this feature!

Actions #17

Updated by Viktor Neufeld over 8 years ago

For other people who find this.

Debian 7, Redmine 1.4.4

Similar as Filou Centrinov mentioned above, add this at the end of your /public/javascripts/application.js

function addTargetExternalLinks() {
  $$('.external').each(function(link) {
    link.setAttribute('target','_blank');
  });
}

Event.observe(window, 'load', addTargetExternalLinks);
Actions #18

Updated by Anthony Cartmell about 8 years ago

For Redmine 3.1.3, add this to the bottom of /public/javascripts/application.js:

function addTargetExternalLinks() {
  $('.external').attr("target", "_blank");
}

$(document).ready(addTargetExternalLinks);

Update 5 July 2019: This still works nicely, with Redmine 4 too. Following adding this code, you might need to get your browser to re-load the application.js file instead of using the old one in the browser's cache.

See also #1151

Actions

Also available in: Atom PDF