Feature #3801
closedLinks to external pages should get a target="_blank" attribute
Added by Roderik van der Veer about 15 years ago. Updated almost 9 years ago.
0%
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
Updated by Ewan Makepeace about 15 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?
Updated by Roderik van der Veer about 15 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.
Updated by Adam Piotr Żochowski about 15 years ago
- 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.
Updated by Henrik Ammer about 15 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
Updated by Olivier Farlotti over 14 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
Updated by Matt N about 13 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
Updated by Mischa The Evil about 13 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.
Updated by Matt N about 13 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.
Updated by Rob C over 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).
Updated by Daniel Felix almost 12 years ago
- Status changed from New to Closed
- Resolution set to Duplicate
Closing this as duplicate of #1151.
Updated by Filou Centrinov almost 12 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); }
Updated by Filou Centrinov over 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);
Updated by Samuel Suther over 10 years ago
This is still not implemented in the Core till now.
Would be gread if Redmine had this feature out of the Box!!!
Updated by Miroslav Zaťko over 9 years ago
+1
Would be great if Redmine had this feature!
Updated by Viktor Neufeld over 9 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);
Updated by Anthony Cartmell almost 9 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