Posted By

vagrantradio on 02/16/10


Tagged

jquery blank links external a rel target href


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

pauloc
harrydeluxe
vehler
jfherring
Balamir


ADD TARGET BLANK TO ALL EXTERNAL LINKS


 / Published in: jQuery
 

Add target blank or rel external to outgoing links automatically.

  1. $("a[href^=http://]").not("a[href^=http://www.yourdomain]").attr("target", "blank");
  2. $("a[href^=http://]").not("a[href^=http://www.yourdomain]").attr("rel", "external");

Report this snippet  

You need to login to post a comment.