Created
May 13, 2010 18:07
-
-
Save jpinnix/400152 to your computer and use it in GitHub Desktop.
jQuery - Make all external links open in new tab/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
// JQuery - Make all external links open in new tab/window | |
// Mashup of: | |
// http://travisroberts.tumblr.com/post/595428703/jquery-external-links-open-new-window | |
// http://snipplr.com/view.php?codeview&id=29949 | |
$(document).ready(function() { | |
$("a[href*='http://']:not([href*='"+location.hostname+"'])").click( function() { | |
window.open( $(this).attr('href') ); | |
return false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment