The Footer scriptFirst, the following code was added to the Footer() function in utils/Footer.asp. Out ( '<script language="JavaScript" type="text/javascript">' );
Out ( 'var sWidth = \'?width=\' + screen.width;' );
Out ( 'var sRefer = \'&refer=\' + document.referrer;' );
Out ( 'var sURL = \'&url=\' + document.URL;' );
Out ( 'document.write(\'<img src="StatCounter.asp\' + sWidth + sRefer + sURL + \'" width=1 height=1 border=0 alt="">\' );' );
Out ( '</script>' );
// now for those brain dead browsers that don't support
// JavaScript, or who have it turned off
Out ( '<noscript><img src="StatCounter.asp" width=1 height=1 border=0 alt=""></noscript>' );
|
After the <script> statement, which marks the start of the client-side script, I store some information that the browser freely provides. There is much more information than this, but it very quickly gets untidy dealing with IE/NS/Opera differences. This was all I needed anyway. The "document.write" statement outputs the contents to the browser as if it was originally part of the HTML stream - it's just an <img> tag with my data passed in the URL. Note that instead of an gif or jpg being referenced, the URL points to an asp file! Lastly, I use the <noscript> tag to output the <img> normally, without any extra information. Part 3: The StatCounter.asp "image"... |