Closing browser

Last post 06-29-2009 12:57 AM by Nai-Dong Jin - MSFT. 4 replies.

Sort Posts:

  • Closing browser

    06-22-2009, 11:20 PM
    • Member
      31 point Member
    • asdf fdsa
    • Member since 02-11-2009, 11:33 PM
    • Posts 122

     Hi, I am making a website, and in my database I have to say if a user is online or offline, so when they log in, I have to tell the database that they are online and when they log out, I have to say that they are offline, but what if the person closes the browser or  the tab, I have a session, when they close the browser, does it fire the end session event in the global, or what can I do, please help.


    Thank you!!!!

  • Re: Closing browser

    06-23-2009, 2:16 AM
    • Star
      10,646 point Star
    • sumitd
    • Member since 07-16-2008, 4:32 PM
    • Bangalore
    • Posts 1,872
    Please mark it as answer if it resolves the issue.

    visit: http://technicalsol.blogspot.com

    Latest ajax control toolkit (Release: May 13, 2009): http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27326
  • Re: Closing browser

    06-23-2009, 2:25 AM
    • Member
      140 point Member
    • s_selvan
    • Member since 06-19-2009, 9:24 AM
    • Posts 25

     Use AJAX to trigger the window close event. Above mentioned URL is helpful to you.

  • Re: Closing browser

    06-23-2009, 1:29 PM
    • Member
      31 point Member
    • asdf fdsa
    • Member since 02-11-2009, 11:33 PM
    • Posts 122

    Hi, thanks, but I can't use ajax. Do you have any other solutions?

     

     

     Thank you!!!!

     

     

  • Re: Closing browser

    06-29-2009, 12:57 AM
    Answer

    Hi,

    If you can't use Ajax in your scenario, you may perform an xmlhttprequest to an httphandler you defind on your app. (under the same domain), you can pass the userid as parameter to that handler, and the handler recieve the parameter and update the online status in the datatable accroding to the user id.

    You may send the request in OnbeforeUnload or window close event. But if you use the practice, I suggest that you need to use Iframe architecture.(Main Frame contain the child frame). And you should perform the requesting in main page's OnbeforeUnload event, otherwise, it will request the handler when we redirect to other pages of the site which we do not expect.

    Thanks.

     

    Michael Jin.
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (5 items)