Skip to content

Instantly share code, notes, and snippets.

@liamr
Created February 19, 2014 23:48
Show Gist options
  • Save liamr/9104020 to your computer and use it in GitHub Desktop.
Save liamr/9104020 to your computer and use it in GitHub Desktop.
Open external links in a new window
$("a[rel=external], a[href^='http:']:not([href*='" + window.location.host + "']), a[href^='https:']:not([href*='" + window.location.host + "'])").each(function(){
$(this).attr("target", "_blank");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment