Return to Snippet

Revision: 4405
at December 6, 2007 07:06 by markrocky


Initial Code
function doStandardsCompliantExternalLinks() {
	if (!document.getElementsByTagName) {return;}
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		if (anchors[i].getAttribute("href") && anchors[i].getAttribute("rel") == "external") {// for example: title="Download Adobe Reader" rel="external"
			anchors[i].target = "_blank";
			anchors[i].title += " - Opens in new window";
		}
	}
};

Initial URL


Initial Description
opens links in new window, the standards compliant way, using rel="external" - for example: title="Download Adobe Reader" rel="external"

Initial Title
Standards Compliant External Links

Initial Tags


Initial Language
JavaScript