jQuery open external links in new window

To open external links in new window, use the following jQuery JavaScript:
$("a[href^='http:']").not("[href*='" + window.location.hostname + "']").attr('target','_blank');
Did this help you? Please let me know with a comment. Thank you
Posted .

Comments (RSS)

Leave a comment