Letting a user know their session has ended

Hello.

The problem: The user opens a form - goes away - comes back to an open form and types a few lines into a text box (after their session has ended) - clicks ‘submit’ and gets a timeout/session expired message.

I have tried adapting something from this:

The AJAX code on Andrei’s page does not work for me. I get http_request.status == 404 instead of 200.

I have been unsuccessful in doing the following:

  • Ending a session when a user leaves the site

  • Letting the user know when their session has ended (immediately - without allowing them to continue typing in some text box)

Any help would be appreciated.

Leonardo