#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    50
    Rep Power
    14
    I am calling a perl script when a user exits a page through javascript with something like the following:

    <script language="javascript" type="text/javascript">
    function person_out()
    {
    document.writeln("<scr" + "ipt language='javascript' src='/cgi-bin/script.pl?foo=" + variable + "'>");
    document.writeln("</scr" + "ipt>");
    }
    </script>
    .
    .
    .
    <BODY onUnload="person_out".......>

    This works in Netscape but not in IE. When the script is called from my html page in IE, I get a blank screen. When I view the source, all I see is the <script language="javascript" src ="/cgi-bin/script.pl?...">. All the rest of the other javascript and html code is gone.

    I know that the script is executed because it does what it's supposed to do. And the reason it has to be onUnload is because I want to know how long the user stays on the page.

    Any help would be appreciated.
  2. #2
  3. Resident DJ
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    283
    Rep Power
    14
    It would be better to have this as a complete redirect in JS and PERL. Add another part of your PERL script that takes them to the actual link.


    <script language="javascript" type="text/javascript">
    function person_out(variable,linkvar)
    {
    window.location("/cgi-bin/script.pl?foo=" + variable + "&link=" + linkVar);
    }
    </script>

    then you links will be
    <a href="javascript:person_out(timeFunction(),'page.html');">link</a>

IMN logo majestic logo threadwatch logo seochat tools logo