ADD TARGET BLANK TO ALL EXTERNAL LINKS


/ Published in: jQuery
Save to your folder(s)

Add target blank or rel external to outgoing links automatically.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.