Skip to content

Instantly share code, notes, and snippets.

@Victa
Forked from bastianallgeier/targetblank.js
Created May 27, 2012 08:29
Show Gist options
  • Save Victa/2802845 to your computer and use it in GitHub Desktop.
Save Victa/2802845 to your computer and use it in GitHub Desktop.
Do your clients have the incurable target=_blank disease for external links? Add this jQuery snippet to your js code to add targets to all external links.
$(function() {
$('a').not('[href*=clientdomain\\.com]').attr('target', '_blank');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment