Skip to content

Instantly share code, notes, and snippets.

@raulanatol
Created April 15, 2016 06:35
Show Gist options
  • Save raulanatol/dee7b84d0a0a1317c149537413595d32 to your computer and use it in GitHub Desktop.
Save raulanatol/dee7b84d0a0a1317c149537413595d32 to your computer and use it in GitHub Desktop.
Automatic target="blank" to external links
var mainURL = location.protocol + '//' + location.host;
$('a').not(':contains(mainURL)').click(function(){
this.target = "_blank";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment