Created
July 24, 2012 20:04
-
-
Save runningrhetoric/3172279 to your computer and use it in GitHub Desktop.
if external link add target:_blank
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
$("a[href^=http]").each( function(){ | |
if(this.href.indexOf(location.hostname) == -1) { | |
$(this).attr('target', '_blank'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment