Skip to content

Instantly share code, notes, and snippets.

@6ui11em
Forked from yvesvanbroekhoven/jquery-extlink.js
Created March 7, 2012 16:35
Show Gist options
  • Save 6ui11em/1994233 to your computer and use it in GitHub Desktop.
Save 6ui11em/1994233 to your computer and use it in GitHub Desktop.
JQuery: Open external link in a new window
/*
* Open external link in a new window
*/
$('a:not([href^="'+ window.location.protocol + '//' + window.location.host + '"]):not([href^="#"]):not([href^="/"])')
.attr('target', '_blank');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment