Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 338287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:24:55+00:00 2026-05-12T10:24:55+00:00

there is an alternative to the Javascript onUnload ? I use JSP Jakarta Struts

  • 0

there is an alternative to the Javascript onUnload? I use JSP Jakarta Struts framework with a Servlets.

I must know, when is window closing, because not everyone clicks on Logout button.
How do you handle it in your applications?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:24:56+00:00Added an answer on May 12, 2026 at 10:24 am

    Generally speaking, it’s impossible to determine conclusively whether a visitor is still “using” (or even looking at) your page. Once the browser has downloaded the page, it’s no longer in contact with the server at all, so the page could stay open for a few seconds or a few years and the server would have no idea.

    The unload event is certainly a helpful clue, since it usually fires when the page is unloaded. It’s not at all reliable, however. There are plenty of situations where it won’t fire, and plenty more where even though it does fire your server will remain unaware of it.

    For example: the browser (or even the operating system) could crash, or the power could go out. A visitor using Wi-Fi could get disconnected, or could carry her iPhone into a tunnel while using your site.

    The standard workaround for this — which we all readily admit is terrible — is to let the visitor’s session timeout. Even on high-stakes banking websites, you’ll find that if you walk away from your computer for four minutes and come back you still have access, but if you walk away for five you’re locked out.

    This setup certainly finds a lot of false positives: cases where a visitor was still using your page without interacting with it, and therefore is inconvenienced by the timeout. It also allows false negatives: cases where the real visitor has walked away, and a malicious user takes over within the timeout period.

    The only major addition to this scheme we’ve seen lately is exploitation of JavaScript to visibly log the user out after the timeout period. Again, we see this on banking websites: leave the page open for too long and when you come back all you’ll see is a login screen. (Of course, this too depends on JavaScript and so is still fallible.)

    Unfortunately, since HTTP is a stateless protocol, we’ll never be able to know for sure what’s going on in the browser (especially if JavaScript is off), so cheap workarounds are really all we can use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.