Return to Snippet

Revision: 27483
at June 10, 2010 14:38 by math89


Initial Code
// Open external links in new windows using jquery
$('a[href^="http://"]').filter(function() {
    return this.hostname && this.hostname !== location.hostname;
}).attr('target', '_blank');

Initial URL
http://www.andrewgreig.com/2010/05/use-jquery-to-open-all-external-links-in-a-new-window/

Initial Description
parse every anchor (<a href="#"></a>) on your page

Initial Title
open al external link in new window

Initial Tags
link, jquery

Initial Language
jQuery