Created
October 12, 2012 10:34
-
-
Save Eruant/3878620 to your computer and use it in GitHub Desktop.
Load external links in new window / tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function set_external_links() { | |
$('a[href^=http]').not('a[href^="'+window.location.protocol+'//'+window.location.host+'"]').click(function(e){ | |
e = window.event || e; if(e.preventDefault) e.preventDefault(); else e.returnValue = false; | |
window.open(this.href); return false; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment