Problems with Firefox and Calling a Remote Script

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!
 
B

bbammes

I got my code working... it seems that Firefox's security won't let
you execute a remote script (it seems to only allow execution local
PHP scripts). So I created a local PHP script that opened an HTTP
socket to the remote script. This got everything working properly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top