How to track browser closing event?

Hi Everyone,
I ran into a problem, which I thought at first would be a very easy thing to solve. Unfortunately, I spent few hours already reading through the forums posts and could not find the answer. Some say it is impossible to implement. I think there has got to be a solution to this problem.
I need to track user's login time into the JSP application and record both login and logoff timestamps. I had no problem with the login. Just instantiated my TimeTracker object on the index.jsp page and it writes a new row into the database every time user hits this page. However, things are different with the logoff. User can exit out in three dirrent ways. One is to click the "Exit" button, second is when session expires and the third is when "X" button of the browser is clicked and browser shuts down. I can control first two scenarious. I don't know what to do about the user closing the browser.
I tried capturing onCLose, onUnload or onBeforeUnload events but all of them are also invoked when window gets instantiated or when user clicks on a different page within the application. I also tried instantiating an applet within my JSP template and invalidate session inside its destroy() method but the problem here is that the applet gets destroyed every time a different page within the application is accessed.
I am ready to give up and just leave it as it is now, let the session expire on its own and take care of the logoff time.
Did anybody have similar problem and found the resolution?
Any help would be greatly appreciated.
Thanks,
YM

The common answer is that there is no good way to track the browser closing. A page can't tell the difference between the browser closing and simply navigating to a different page, so determining when the broswer is actually closed is a tough task. There have been some complex solutions in the past, but none seemed to be guaranteed to work, and as such, are pretty much useless for most applications.

Similar Messages

  • How to detect browser close event in flex ?

    How to detect browser close event in flex ?

    This link may help:
    http://cookbooks.adobe.com/post_Close_event_of_browser_or_browser_tab-18211.html
    Best,

  • How to track application exit event?

    I have my swf embeded in Asp.Net. I want to track application exit event. Is there any event which is called when flex application exists or unload or destroyed? I tried application close event but it is not working. I do not want events of browser close or etc because I already tried it.
    Thanks,
    -Chandu

    if you wanted to just close the window all together you could write some Javascript to close the window, then in your flex app call the function when they click the logout button
    If you want to actually end it with Actionscript you could try:
    public function applicationExit():void {  
         var exitingEvent:Event = new Event(Event.EXITING, false, true);  
         NativeApplication.nativeApplication.dispatchEvent(exitingEvent);  
         if (!exitingEvent.isDefaultPrevented()) {      
              NativeApplication.nativeApplication.exit(); 
    Source: http://livedocs.adobe.com/flex/3/html/help.html?content=app_launch_1.html
    UKB

  • How to catch browser close event excluding navigation events

    Hi,
    I tried using onBeforeUnload event and onUnload events.. but they are catching navigation events within the same site. Could you please let me know how I can catch browser close events without catching Navigation events?
    Thanks.

    Just set them to null when navigation takes place.
    Said that, you should be asking Javascript/DHTML related questions in a forum devoted to Javascript/DHTML. There are ones at webdeveloper.com and dynamicdrive.com. This has nothing to do with Java.

  • How to get the closing event (not closed) of Dialog control

    Hi All,
    I have one requirement, that I have to close the Dialog box in an animated way like on clicking of the Dialog close button the popup has to close from top to bottom in a slide effect.
    sap.ui.commons.Dialog
    When I tried closed method of Dialog, it is calling only after dialog box closed but, I need the closing event rather closed event.
    I am putting a UI5 view in Dialog as I need some custom/dynamic content in the dialog.
    Please suggest the solution for this.
    Thanks & Regards,
    Pavan Thirunamala,
    [Moderator Message - Please do not provide contact information like Phone Number etc in the discussion message. It has been removed.]
    Message was edited by: Chandrashekhar Mahajan

    JS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type="application/jso…
                sap.ui.getCore().getEventBus().subscribe("sap.ui","__beforePopupClose",
    function(channel, event, params)
      debugger;   
    $(params.domNode).animate({
                      opacity : 1,
                  height : 0

  • How to track tab changed event

    hi friends ,
    i have created a JTabbePane and added few tabs like, addd tab, delete tab, modify tab.... etc
    how do i track the evnt when user select different tab . i have to perform few tasks when the tab selectio changes.. so how do i do that
    pls do help , thnks

    when you need to intercept an event look to methods
    add....Listener normally you find out what you need.
    Sometimes you have to look at
    getModel().add....Listeneryes , i tried what you said and it showed me all the listeners for that component , thanks once again for your valuable suggestion

  • How to track browser type in the access log

    I have looked through the documentation on logging features on how to log the browser
    type for visitors. Is there a straightforward way to do add this information
    to the access.log?
    We are using Weblogic Portal 7.0 sp4
    Thank you.

    Hi,
    What do you mean by current and old version? Any changes in history log under general settings-->service tab?
    Thanks & Regards,
    Nagarajan

  • Browser Close Event

    Hi,
    I want to track Browser close event in EP to close all the sessions of the user.
    Plz guide me with detailed steps.
    Thanks in advance.
    Regards,
    Priya

    Hi search for "Browser close event" in google.
    Result: there is no such thing. You can do something with onbeforeunload but that might not work for all browser.
    Kai

  • How to trap applet window closing event?

    Hi all,
    I would like to know how could one trap the event of the browser window containing an applet being closed by the user?
    Thank you,

    Hi. this would be useful to me too.
    Trouble is, I'm not sure that you can. applet.stop( )
    and applet.destroy( ) might be called, but there is
    no guarentee that you can complete processing before
    you are terminated, especially if you need to do
    something slow, like returning state data to your
    server. And you can't stop the broswer closing.
    I know that in Javascript, you can catch and even
    stop the browser window being closed, which is how
    things like goggledocs can ask for confirmation
    before closing. (window.onbeforeunload( ) ).
    I have toyed with the idea of having a
    javascript/ajax thread in my html, to catch this
    termination, and communicate back to the server from
    java to say a document has changed, but it all seems
    rather heavyweight for such a simple task.Look at Runtime.addShutdownHook()
    You could also try using a WindowListener as well and trap the WindowClose Event.
    stop() should do very little other than invalidate the current thread/run flags
    and then exit. ie: a stop() example
    public void stop()
    task = null;
    or
    public void stop()
    running = false;
    Your run method should look for a stop condition and then exit.
    Otherwise you could be doing stop processing while run is still
    running.
    (T)

  • How do I find the root cause of a NetConnection closed event?

    Hi,
    I am maintaining a large project developed in Flex/Actionscript.
    The application is using tunneling (RTMPT), and we often get Netconnection "closed" events.
    There is no problem with the physical network.
    I think the event may be caused by either a TCP/HTTP/RTMP event, or may be caused by
    some function in the client calling close() on the connection.
    How can I find the root cause of the "closed" event being thrown?
    Thanks,
    David

    Thanks for the information.  It is helpful but it seems there must be a specification of
    what the client side is expecting, independent of any server implementation. 
    When I say client side, I mean the Adobe communication libraries.
    Where is the specification or source code for how the client libraries treat HTTP tunneled requests and responses?
    One question in particular:  How does the client side library treat a
       Connection: Keep-Alive
    versuse
       Connection:close
    HTTP header setting?

  • How to stop Execution of Queries when the Browser closed in middle?

    Hi,
    I have JSP search page, which takes search parameters from previous page runs queries and display the results. I am using connection pool to connect to AS400 database.
    The problem I am facing is... The query still runs on database server, when the user closes browser before getting the search results.
    I am closing all my statements and returning connection to pool at the end of the JSP page.
    Is there any way to terminate the execution of the queries, when the user closes browser?
    Thanks in advance.

    Allright.
    As you know there is no direct way to catch that event, you will have to do this workaround :
    1. Create a class which implements HttpSessionBindingListener. The valueUnbound method will have flag or code to stop running query.
    2. Instantiate this in your search page, and add it into session.
    3. Add javascript in search JSP to access another(dummy) JSP on unload event(to catch browser closing) something like:
    function unload()
    location.href = "/kill.jsp";
    4. The code in dummy JSP will remove the object from session, and will fire valueUnbound method.
    Let me know if this helps.
    -Mak

  • How do I stop iPhoto from repeatedly closing Event title boxes when I am in the middle of entering a title?

    How do I stop iPhoto from repeatedly closing Event title boxes when I am in the middle of entering a title?
    This problem started several months ago. I have tried typing more slowly and typing faster; neither help.
    It now takes me about four attempts to complete a title of about twelve characters, achieving about three characters on each attempt.
    I am running iPhoto 9.4.3 on OS X 10.8.3 on a 2.93 GHz Intel Quad-Core i7 iMac with 12 GB of DDR3 memory.

    As a Test:
    Hold down the option (or alt) key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • How can we track the entire event in which the form mode gets changed?

    If the form is in OK Mode and if the user edits any field(Including UDF Window Fields). form mode changes to Update...So at that time, how can we track the entire event in which the form mode gets changed?
    Thanks
    Hari

    Dear hari angamaly,
    You could get the form mode by FormMode Property in ItemEvent Object in UI API.
    Best Regards
    Jane Jing
    SAP Business One Forums team

  • Catch Browser closing

    Ahh come on, has anyone found a workaround for detecting the browser closing so the session may be ended. This seems like a major in working with web apps.

    Hi!
    Use HttpSessionListener for session tracking.
    It provides two methods sessionCreated() and sessionDestroyed().
    When browser closing you get an event to sessionDestroyed method, there is also such event on session timeout.
    Regards,
    parasolko

  • Detecting browser closing

    Is there a way to detect when the safari browser closing?  I am writing a web application that needs to detect when a user abandons the website.

    How perfect do you need it to be? You can use the onblur() event of the window, but there is no guarantee that it will be called. The only real guarantee is a missed heartbeat.

Maybe you are looking for

  • No audio device installed after windows vista sp2 update

    Ok I will try to be as thorough as possible because I want to fix this problem and I hope somebody can help me. So A few days ago There was an update for my audio driver so I accepted. But after this update my sound worked but on next use the sound w

  • Enable tool tip in Exported PDF document from a CRE Report

    Hi All, We are on BObj 4.0 and using CRE for our reports. We have enabled Tool tip text on mouse over for certain labels which works great in browser. When we export to PDF, we dont see the Tool tip text. Is there a way we can configure this in CRE s

  • Podcast Get Info Album Art Not Saved for Future Episodes

    I have iTunes 8. I noticed most of my podcasts have album art showing in grid view. When I upgraded to 2.1 on my iPhone and synced my iPhone I noticed no album art on the podcast main page on the iPhone. I decided to restore the phone to a new phone

  • Snippets in Flash Builder ?

    Will there be an option to save snippets in Flash Builder ? My experience is that I spend WAY more time looking up code than creating stuff in Flex. Snippets would be a colossal timesaver...

  • Select into statement returns 0 or 1

    Hello, when i run the select statement below ,the result in count field is 0 when the record is not exist and 1 when the record is exist but the real value doesn't appear in the field , what the problem exactly .........i want to show the real value