/    Sign up×
Community /Pin to ProfileBookmark

Time out and warning messages

I’m looking for a script, or at least something I can sart from to do the following:

  • 1.

    Set the timeout to 20 minutes

  • 2.

    Warn the user two minutes before the page will time out with a pop-up. If the user says ‘yes I want to continue’ within the two minutes, reset the timeout to the original 20 minutes and NOT loose what the user has entered so far.

  • 3.

    If the user doesn’t click on the ‘yes I want continue’ within the two minuate, time the user out and log them off, sending the screen back to the login page.

  • I’ve seen lots of sites work like this and I wrote some code on my own when I couldn’t find any, but one big problem is that (a) when the user clicks ‘yes I want to continue’, I refresh the page and loose all that they entered. Not cool. And there are other oddities.

    Anyways, does anyone know where I can find some code to use as a basis?

    Thanks.

    to post a comment
    JavaScript

    3 Comments(s)

    Copy linkTweet thisAlerts:
    @felgallNov 08.2005 — This would require a combination of client and server side processing. Also what are you going to do when a popup blocker stops the popup appearing?
    Copy linkTweet thisAlerts:
    @d2foxauthorNov 08.2005 — Well, I'm actually putting the message in an 'alert' box and my pop-up blocker doesn't block it. Is this a problem?

    I am setting the timeout and the warning box is showing two minutes prior to the timeout. That part actually works fine. Issues with my code include:

    (1) My alert box stays up after the two minutes have elapsed, so then the user can select 'continue' and it keeps them logged in.

    (2) If the user selects 'continue', all the input that they have entered up to that point goes away. Not cool.

    (3) My redirect on timeout isn't working, e.g. the screen doesn't automatically go back to the login after the timeout. However, the user is logged out, as the next time they hit enter, it takes them back to the login screen.
    Copy linkTweet thisAlerts:
    @A1ien51Nov 08.2005 — You may want to check out this script I wrote that uses Ajax for tracking session.

    http://radio.javaranch.com/pascarello/2005/10/25/1130246930301.html

    Eric
    ×

    Success!

    Help @d2fox spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...