Results 1 to 6 of 6

Thread: Running code on Unload

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Running code on Unload

    I need to run some ASP code when I go to close down the browser. I can run Javascript no problem, but I just need to run a funcation that I have set up in me ASP Code.

    Can anyone help?
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    There's really no way ASP could know when the browser closes.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    Can you not run some ASP code by calling <BODY OnUnload="??">
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  4. #4
    Lively Member
    Join Date
    Jan 2001
    Posts
    118
    Do yourself a favor, save yourself time. Just put an alert in the unload event. You will see it fires every time even if you refresh your browser.

    I wanted to the same effect, but if you refresh ... the function executes...

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Can you not run some ASP code by calling <BODY OnUnload="??">
    Just client-side code. You could possibly request an ASP page there to get ASP code to execute, but if the browser is closing, I'm not sure if it will actually request the ASP page.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  6. #6

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    Thanx for that, sorted it, just in case it may be of help to you heres how its done.

    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
    function MM_goToURL()
    {
    var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
    for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
    }
    //-->
    </SCRIPT>
    </HEAD>
    <BODY OnUnLoad="MM_goToURL('parent','unload.asp')">

    I just had unload.asp do the work.
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width