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. Advertisements

  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. Advertisements

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. Replies:
    1
    Views:
    454
    Chris Rebert
    Feb 18, 2009
  2. davidj411
    Replies:
    7
    Views:
    3,983
    Tim Golden
    Oct 8, 2009
  3. Rajat
    Replies:
    3
    Views:
    987
    Jorgen Grahn
    Jan 8, 2010
  4. VYAS ASHISH M-NTB837
    Replies:
    2
    Views:
    761
    Jan Kaliszewski
    Jan 7, 2010
  5. Jeff Wood
    Replies:
    7
    Views:
    420
    Jeff Wood
    Oct 18, 2005
  6. 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:
    370
    Markus R. Keßler
    Dec 16, 2009
  7. ashish
    Replies:
    4
    Views:
    472
    ashish
    Sep 20, 2012
  8. ashish
    Replies:
    5
    Views:
    701
    Piet van Oostrum
    Sep 20, 2012
Loading...