Posted By

metoikos on 01/22/10


Tagged

link jquery


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

matpolster


jquery external link new window


 / Published in: JavaScript
 

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

Report this snippet  

You need to login to post a comment.