/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('a').each(function() { Â Â var a = new RegExp('/' + window.location.host + '/'); Â Â if(!a.test(this.href)) { Â Â Â Â $(this).click(function(event) { Â Â Â Â Â Â event.preventDefault(); Â Â Â Â Â Â event.stopPropagation(); Â Â Â Â Â Â window.open(this.href, '_blank'); Â Â Â Â }); Â Â } });
Comments
