Browser close event (MSIE and FF): how to detect browser close ?

Discussion in 'Javascript' started by, Jan 23, 2007.

  1. Guest

    Hi Guys

    this time I have a question which involves both Javascript and perhaps

    Ok. I am working on a sort of reporting systems which works like this:

    There is an IIS ASP.NET server. On the server there is a binary file
    (call it "Source Report") which
    stores all informations to create an HTML page (call it "Web Report").

    There is a JAVASCRIPT file on the server (which is referred to inside
    the Web Report) which
    is responsible to send, via get, some commands (for instance a "drill
    down") from the Web report to
    an file .aspx (call it "Report Processor"), which sends the command to
    the server which, in case, regenerates the Web Report by a direct write
    to disk and redirect the user's browser to the new version..

    To allow concurrency, everytime a user make a request of a report, I do
    this: I create a new temporary folder
    (the name of the folder id a basically reportID+Timestamp). In the
    temporary folder I copy the Source Report and then everything the user
    does on the report (regeneration, drill, change the report by sending
    parameters, etc) happens within that folder.

    This way the user can work on multiple different instances of the same
    Source Report, and can have completely different views (Web Reports) of
    the same Source report. For each report instance which is created I
    store all relevant information (including an identificator and temp
    folder name) in a session variable, so it can be retrieved any time.
    Each Web Reports stores inside the instance identificator.

    --> Now my question. When the user closes the browser and goes away I
    would like to be able to do some cleanup programmatically. For
    instance, I would like to remove the temporary folders created to deal
    with report instances.

    Could you advise for the best method to detect when the user closes the
    browser and send this information to the server through my aspx file
    (Report Processor) ? In other words, can you see a function I can place
    in my JS file which would transmit (via GET) the event to the aspx and
    therefore to the server?

    Hope I have been clear with my poor English. Please just ask if not ...

    Thank you

    , Jan 23, 2007
    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. sm mehta

    how to detect Browser close event.

    sm mehta, Jul 29, 2003, in forum: ASP .Net
    Steve C. Orr, MCSD
    Jul 29, 2003
  2. mic
    Roger Upole
    Jan 14, 2004
  3. Jeff Bowes
    Jeff Bowes
    Oct 28, 2004
  4. Replies:
    Aug 9, 2006
  5. Mike Scirocco
    Mike Scirocco
    Apr 5, 2007

Share This Page