/*
*
* the 'target' attribute is not XHTML compliant:
*
*
*
* however, the target parameter is DOM compliant,
* so a workaround is to use javascript to set
* the target for 'external' links
*
* as per:
* http://www.sitepoint.com/article/1041/3
*
* 29-nov-2003 wrote externalLinksByHref function,
* which just changes all off-site links to
* use target _blank
*
* - chris paul
*
*/
function externalLinksByHref() {
var base_url = (document.URL ? document.URL : document.location.href).substr(0,(document.URL ? document.URL : document.location.href).indexOf('/',8));
if (document.getElementsByTagName) {
var anchors = document.getElementsByTagName('a');
for (var i=0; i=0; i--) {
var anchor = anchors[i];
if ((anchor.href.indexOf('http:\/\/')==0 || anchor.href.indexOf('https:\/\/')==0)
&& anchor.href.indexOf(base_url)<0) {
anchor.target = '_blank';
}
}
}
}
window.onload = externalLinksByHref;
/*
* original concept follows:
* http://www.sitepoint.com/article/1041/3http://www.sitepoint.com/article/1041/3
*
*/
function externalLinksByRel() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName('a');
for (var i=0; i