Skip to content

Instantly share code, notes, and snippets.

@zilongshanren
Forked from azone/open-in-blank.js
Last active January 2, 2016 06:39
Show Gist options
  • Save zilongshanren/8265374 to your computer and use it in GitHub Desktop.
Save zilongshanren/8265374 to your computer and use it in GitHub Desktop.
function addBlankTargetForLinks () {
$('a[href^="http"]').each(function(){
$(this).attr('target', '_blank');
});
}
$(document).bind('DOMNodeInserted', function(event) {
addBlankTargetForLinks();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment