B
bbammes
I'm writing a click tracking program which calls a remote PHP script
when a user clicks a link. My javascript is:
<script type="text/javascript">
//<![CDATA[
function trackclick( id ) {
if( document.images ) {
( new Image( ) ).src = "http://www.example.com/scripts/
trackclick.php?" + "id=" + id + "&referrer=" +
escape( document.referrer ) + "&clientagent=<?php echo
urlencode( $_SERVER[ 'HTTP_USER_AGENT' ] ); ?>&clientaddress=<?php
echo urlencode( $_SERVER[ 'REMOTE_ADDR' ] ); ?>";
}
return true;
}
//]]>
</script>
This function is called from the onclick events of links throughout
the page.
This works flawlessly in IE, but I can't get it working in Firefox.
I've spent awhile debugging this... Firefox executes trackclick( ) on
an onclick event... "document.images" evaluates as true in Firefox...
so the problem seems to be that Firefox never calls my PHP script
(i.e. it never tries to get the new image data).
Anyone have any ideas? Thanks!
when a user clicks a link. My javascript is:
<script type="text/javascript">
//<![CDATA[
function trackclick( id ) {
if( document.images ) {
( new Image( ) ).src = "http://www.example.com/scripts/
trackclick.php?" + "id=" + id + "&referrer=" +
escape( document.referrer ) + "&clientagent=<?php echo
urlencode( $_SERVER[ 'HTTP_USER_AGENT' ] ); ?>&clientaddress=<?php
echo urlencode( $_SERVER[ 'REMOTE_ADDR' ] ); ?>";
}
return true;
}
//]]>
</script>
This function is called from the onclick events of links throughout
the page.
This works flawlessly in IE, but I can't get it working in Firefox.
I've spent awhile debugging this... Firefox executes trackclick( ) on
an onclick event... "document.images" evaluates as true in Firefox...
so the problem seems to be that Firefox never calls my PHP script
(i.e. it never tries to get the new image data).
Anyone have any ideas? Thanks!