Created
May 28, 2012 10:21
-
-
Save markreale/2818361 to your computer and use it in GitHub Desktop.
Open External Links in a New Window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************ | |
* * | |
* Open external links in a new window. * | |
* - requires links to have a 'rel' attribute * | |
* of "external" * | |
* - requires jQuery * | |
* * | |
************************************************/ | |
function externalLinks(){ | |
$('a[rel="external"]').click(function(e){ | |
e.preventDefault(); | |
window.open($(this).attr('href')); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment