Skip to content

Instantly share code, notes, and snippets.

@kristof
Created March 1, 2012 08:07
Show Gist options
  • Save kristof/1948207 to your computer and use it in GitHub Desktop.
Save kristof/1948207 to your computer and use it in GitHub Desktop.
Blank target for external link
$("a[href^='http:']:not([href*='" + window.location.host + "'][target='_blank'])").on('click', function(){
$(this).attr('target','_blank');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment