Return to Snippet

Revision: 43070
at May 10, 2012 03:07 by mindshare


Updated Code
// open external links in new window (checking domain first)
jQuery("a[href^='http']:not([href*='" + document.domain + "'])").each(function () {
	jQuery(this).attr("target", "_blank");
});

Revision: 43069
at March 16, 2011 05:01 by mindshare


Updated Code
// open external links in new window (checking domain first)
jQuery("a[href^='http']:not([href*='example.com'])").each(function() {
	jQuery(this).attr("target", "_blank");
});

Revision: 43068
at March 16, 2011 05:00 by mindshare


Initial Code
// open external links in new window (checking domain first)
jQuery("a[href^='http']:not([href*='jlhmedia.com'])").each(function() {
	jQuery(this).attr("target", "_blank");
});

Initial URL


Initial Description
Automatically use jQuery to Open External Links in New Window (checking domain first).

Initial Title
Automatically use jQuery to Open External Links in New Window (checking domain first)

Initial Tags
window, browser, jquery

Initial Language
JavaScript