Open All Off-site Links in a New Window


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



Copy this code and paste it in your HTML
  1. $(document).ready(function() {
  2.  
  3. $("a").filter(function() {
  4. return this.hostname && this.hostname !== location.hostname;
  5. }).attr('target', '_blank');
  6.  
  7. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.