This project is read-only.

This repository has moved to GitHub. Please visit the new repository at https://github.com/Lombiq/Orchard-Target-Blank.

The CodePlex page is not maintained anymore, but still here for historical reference.

Documentation

Usage

Install and enable the module if you want to have outgoing links open in new windows.
If you want a link to exclude from this rule, use the "no-target-blank" class on it.

Version history

  • v1.0.2 (19.11.2012):
    • Updating to VS 2012 project file
    • JS refactoring
  • v1.0.1 (29.02.2012): Maintenance release
  • v1.0 (26.10.2011): First public release.

Last edited Nov 28, 2015 at 5:33 PM by MilanKeszthelyi, version 6

Comments

beebul Jul 28, 2014 at 4:52 AM 
This doesn't work if someone puts an anchor tag without a href on the page (or in a menu) or in a custom content type in the admin area. I found that if I checked if the href is not empty first it solved my issues:

$(document).ready(function () {
$('a:not(.no-target-blank)').each(
function () {

var href = $(this).attr('href');
// Is outgoing link
if (href > '' || href !=null)
{
if (!href.match(/^mailto\:/) && (this.hostname != location.hostname)) {
$(this).click(
function () {
window.open(this.href);
return false;
});
}
}
});
});