Jason - 2005-04-28

hi, thanks for the great project. It's my favorite web stats tool so far.

this change is so small i didnt think it warranted a diff. At the end of the script it is currently appending a child to the body, however, since the script is included in the body of the page, the browser might error when trying to append something to a page which isnt completely rendered yet. I have changed the script so it can be included from the body.

if you dont care about older browser support, you can also change it into a function, remove the document.write part, and call the function from an onload. This way the page display isnt interupted at all.

Change:

var imgsrc = awstatsmisctrackerurl+'?screen='+TRKscreen+'&win='+TRKwinsize+'&cdi='+TRKcdi+'&java='+TRKjava+'&shk='+TRKshk+'&fla='+TRKfla+'&rp='+TRKrp+'&mov='+TRKmov+'&wma='+TRKwma+'&pdf='+TRKpdf+'&uid='+TRKuserid+'&sid='+TRKsessionid;
if( document.createElementNS ) {
var l=document.createElementNS("http://www.w3.org/1999/xhtml","img");
l.setAttribute("src", imgsrc );
l.setAttribute("height", "0");
l.setAttribute("width", "0");
l.setAttribute("border", "0");
document.getElementsByTagName("body")[0].appendChild(l);
} else {
document.write('<img src="'+ imgsrc +'" height=\&quot;0\&quot; width=\&quot;0\&quot; border=\&quot;0\&quot; />')
}

To:

var imgsrc = awstatsmisctrackerurl+'?screen='+TRKscreen+'&win='+TRKwinsize+'&cdi='+TRKcdi+'&java='+TRKjava+'&shk='+TRKshk+'&fla='+TRKfla+'&rp='+TRKrp+'&mov='+TRKmov+'&wma='+TRKwma+'&pdf='+TRKpdf+'&uid='+TRKuserid+'&sid='+TRKsessionid;
if(document.images || document.createElementNS) {
var tempImage = new Image();
tempImage.src = imgsrc;
} else {
document.write('<img src="'+ imgsrc +'" height=\&quot;0\&quot; width=\&quot;0\&quot; border=\&quot;0\&quot;>')
}

also i recommend against using any xhtml tags because most people still use html 4 transitional/strict which does not validate with xhtml tags

thanks