jquery external link new window


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



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


Comments


You need to login to view comments.