Return to Snippet

Revision: 23963
at February 17, 2010 16:12 by relaxasaurus


Initial Code
$(document).ready(function() {
	externalLink();	
});
 
function externalLink() {
	$("a[@href^=http]").each(
		function(){
			if(this.href.indexOf(location.hostname) == -1) {
			$(this).attr('target', '_blank');
			}
		}
	)
};

Initial URL

                                

Initial Description

                                

Initial Title
Open external links in new window without target = _blank using jQuery

Initial Tags
link, window, jquery

Initial Language
JavaScript