Skip to content

Instantly share code, notes, and snippets.

View grammaticof's full-sized avatar

Francesco Grammatico grammaticof

View GitHub Profile
@grammaticof
grammaticof / gist:1994175
Created March 7, 2012 16:23
jQuery: open all external link to a new window
$(document).ready(function() {
$('a[href^="http://"]').filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).attr('target', '_blank');
})