Posted By

math89 on 06/10/10


Tagged

link jquery


Versions (?)

open al external link in new window


 / Published in: jQuery
 

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

parse every anchor () on your page

  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.