Problems with Firefox and Calling a Remote Script

Discussion in 'Javascript' started by bbammes@gmail.com, Mar 8, 2007.

  1. Guest

    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!
    , Mar 8, 2007
    #1
    1. Advertising

  2. Guest

    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.
    , Mar 8, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. davidj411
    Replies:
    7
    Views:
    3,252
    Tim Golden
    Oct 8, 2009
  2. Jeff Wood
    Replies:
    7
    Views:
    193
    Jeff Wood
    Oct 18, 2005
  3. Markus R. Keßler

    Get remote IP in self-calling script

    Markus R. Keßler, Dec 14, 2009, in forum: Perl Misc
    Replies:
    13
    Views:
    233
    Markus R. Keßler
    Dec 16, 2009
  4. ashish
    Replies:
    4
    Views:
    292
    ashish
    Sep 20, 2012
  5. ashish
    Replies:
    5
    Views:
    510
    Piet van Oostrum
    Sep 20, 2012
Loading...

Share This Page