Page Session Countdown Timer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MC

    Page Session Countdown Timer

    I would like to display a timer in the corner of the page that shows the
    user how many minutes:seconds till the session times out. Are there any good
    examples out there?

    Google has again failed me ;)

    MC


  • Evertjan.

    #2
    Re: Page Session Countdown Timer

    MC wrote on 22 mrt 2008 in comp.lang.javas cript:
    I would like to display a timer in the corner of the page that shows
    the user how many minutes:seconds till the session times out. Are
    there any good examples out there?
    Session is a serverside concept.
    Clientside, thee is not such a thing as a session timeout.
    Google has again failed me ;)
    Do you want Google to write your programming?
    It will cost you!


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • MC

      #3
      Re: Page Session Countdown Timer

      Evertjan,

      I have to say your wrong. A javascript can track every time a page loads,
      and knowing the session timeout, calculate an approximate, hopefully +- less
      than one second, session timeout.

      I would like to, given a timeout such as 30 minutes, have a countdown from
      the onload event. It would then be nice to prompt the user to logout or
      continue the session by sending a message back to the server to refresh the
      session.

      I say your wrong, because session timeouts ARE being done currently in many
      websites such as banks. ...and I never suggested Google write my code, but
      that Google search find an appropriate example.

      Please troll someplace else if you have nothing constructive to add.

      MC

      "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
      news:Xns9A69AE9 7BA7ECeejj99@19 4.109.133.242.. .
      MC wrote on 22 mrt 2008 in comp.lang.javas cript:
      >
      >I would like to display a timer in the corner of the page that shows
      >the user how many minutes:seconds till the session times out. Are
      >there any good examples out there?
      >
      Session is a serverside concept.
      Clientside, thee is not such a thing as a session timeout.
      >
      >Google has again failed me ;)
      >
      Do you want Google to write your programming?
      It will cost you!
      >
      >
      --
      Evertjan.
      The Netherlands.
      (Please change the x'es to dots in my emailaddress)

      Comment

      • Evertjan.

        #4
        Re: Page Session Countdown Timer

        MC wrote on 22 mrt 2008 in comp.lang.javas cript:
        "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
        news:Xns9A69AE9 7BA7ECeejj99@19 4.109.133.242.. .
        >MC wrote on 22 mrt 2008 in comp.lang.javas cript:
        >>
        >>I would like to display a timer in the corner of the page that shows
        >>the user how many minutes:seconds till the session times out. Are
        >>there any good examples out there?
        >>
        >Session is a serverside concept.
        >Clientside, thee is not such a thing as a session timeout.
        >>
        >>Google has again failed me ;)
        >>
        >Do you want Google to write your programming?
        >It will cost you!
        [Please do not toppost on usenet]
        I have to say your wrong. A javascript can track every time a page
        loads, and knowing the session timeout, calculate an approximate,
        hopefully +- less than one second, session timeout.
        No it cannot, as there could be another call in that session resetting
        the sererside timeout counter.

        Clientside cannot know that, unless it pols the server by ajax or alike
        to ask the present value of the timeout counter. Under ASP it is not even
        available, I suspect the same goes for PHP, but I don't know.
        I would like to, given a timeout such as 30 minutes, have a countdown
        from the onload event. It would then be nice to prompt the user to
        logout or continue the session by sending a message back to the server
        to refresh the session.
        You cwertainly can do that, but it does not reflect the session state.
        I say your wrong, because session timeouts ARE being done currently in
        many websites such as banks.
        Those sites heavily rely on serverside, I hope.
        ...and I never suggested Google write my
        code, but that Google search find an appropriate example.
        You did not suggest anything of the sort, though I might be what was in
        your mind. You only said Google had failed you. If that was about
        searching and not about the share value, it could also be that your
        searching skills were not perfect. How would we know?
        Please troll someplace else if you have nothing constructive to add.
        So now you become abusive, thinking this NG is your personal helpdesk and
        by asking Qs you have a right to dictate the answers?

        My aswer was constructive, showing you you asked the wrong Q an prompting
        you to a better one.

        A countdown timer in Javascript, you simply could have asked for that,
        is a simple affair, can be written within 10 minutes. But you did not ask
        for that.

        If you stay polite, maybe someone will help you.

        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress)

        Comment

        • MC

          #5
          Re: Page Session Countdown Timer

          Sasuke,

          Thank you. This should work quite nicely! I will be able to show the user
          how much time is left on the page till timeout. I should be able to even
          'show' a form saying they are going to time out in soon, and give them the
          opportunity to refresh the session with a button there.

          Thank you for helping!
          MC


          Comment

          • Dr J R Stockton

            #6
            Re: Page Session Countdown Timer

            In comp.lang.javas cript message <Xns9A69AE97BA7 ECeejj99@194.10 9.133.242>
            , Sat, 22 Mar 2008 16:09:49, Evertjan. <exjxw.hannivoo rt@interxnl.net >
            posted:
            >MC wrote on 22 mrt 2008 in comp.lang.javas cript:
            >
            >I would like to display a timer in the corner of the page that shows
            >the user how many minutes:seconds till the session times out. Are
            >there any good examples out there?
            >
            >Session is a serverside concept.
            >Clientside, thee is not such a thing as a session timeout.
            A client can count down for a length of time indicated by the server;
            and can occasionally be synchronised with the server's opinion.
            >Google has again failed me ;)
            Try "Good countdowns" as your search string.
            As a contrast, seek countdowns on .gov sites.

            TD09690 : Until 03 September 2081 10:07:31 LCT : 26827d 11h 54m 56s .

            --
            (c) John Stockton, nr London, UK. ?@merlyn.demon. co.uk Turnpike v6.05.
            Web <URL:http://www.merlyn.demo n.co.uk/- w. FAQish topics, links, acronyms
            PAS EXE etc : <URL:http://www.merlyn.demo n.co.uk/programs/- see 00index.htm
            Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.

            Comment

            • Evertjan.

              #7
              Re: Page Session Countdown Timer

              Dr J R Stockton wrote on 22 mrt 2008 in comp.lang.javas cript:
              >>Session is a serverside concept.
              >>Clientside, thee is not such a thing as a session timeout.
              >
              A client can count down for a length of time indicated by the server;
              and can occasionally be synchronised with the server's opinion.
              >
              However, John, the server, under ASP at least,
              does not know at the scripting level,
              what the countdown status of the session timer is,
              so much for the server's opinion.

              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              • sasuke

                #8
                Re: Page Session Countdown Timer

                On Mar 23, 4:05 am, "MC" <mica[removethis]@aisus.comwrote :
                Sasuke,
                >
                Thank you. This should work quite nicely! I will be able to show the user
                how much time is left on the page till timeout. I should be able to even
                'show' a form saying they are going to time out in soon, and give them the
                opportunity to refresh the session with a button there.
                >
                Thank you for helping!
                MC
                Glad I was able to help. Hope it all works out well for you. :-)

                Comment

                • Joost Diepenmaat

                  #9
                  Re: Page Session Countdown Timer

                  "Evertjan." <exjxw.hannivoo rt@interxnl.net writes:
                  Not fairly at all.
                  >
                  If the user does alt-N and has two duplicate pages, and clicks to another
                  site page from the second page 15 minutes later, the first page will show
                  the session is gone, while the session lives on happily [though not ever
                  after], and the session can be used from the page with the counter that
                  tells you it cannot.
                  Yeah that's true. There are ways of working around this problem, of
                  course. Provided you've got enough control of the session mechanism at
                  the server side you could just do a periodic Ajax request to check the
                  session status.

                  I still don't know what you mean about the *server* scripts not knowing
                  what the session timer is. Sounds like a really strange restriction to
                  me.

                  --
                  Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

                  Comment

                  • Evertjan.

                    #10
                    Re: Page Session Countdown Timer

                    Joost Diepenmaat wrote on 23 mrt 2008 in comp.lang.javas cript:
                    "Evertjan." <exjxw.hannivoo rt@interxnl.net writes:
                    >Not fairly at all.
                    >>
                    >If the user does alt-N and has two duplicate pages, and clicks to
                    >another site page from the second page 15 minutes later, the first
                    >page will show the session is gone, while the session lives on
                    >happily [though not ever after], and the session can be used from the
                    >page with the counter that tells you it cannot.
                    >
                    Yeah that's true. There are ways of working around this problem, of
                    course. Provided you've got enough control of the session mechanism at
                    the server side you could just do a periodic Ajax request to check the
                    session status.
                    >
                    I still don't know what you mean about the *server* scripts not
                    knowing what the session timer is. Sounds like a really strange
                    restriction to me.
                    Ours is not to ask the why of the language/platform at implementation
                    time,
                    just to implement it.

                    ASP cannot read the actual state of the session timeout counter.
                    PSP probably has the same restriction.

                    The only time that you know it's state is at the reset moment.

                    You could test by Ajax if the session is still active,
                    but that would be done "destructively" ,
                    as the counter is reset by the test.

                    Kind of a quantum measurement dilemma, isn't it?
                    Provided you've got enough control of the session mechanism
                    You could forego the server internal session mechanism,
                    [which depends on a session cookie, btw],
                    and build your own session with a database.
                    Then you can read the last session reset time from that database.

                    That probably is the way some banks do their work, having an session-id
                    in the querystring, and no cookies necessary for that.

                    The above shows a timeout timer is not even necessary, only a comparison
                    of 'now' to the last resettime at every new html request [and some sort
                    of database garbage collection sql execution now and then].


                    --
                    Evertjan.
                    The Netherlands.
                    (Please change the x'es to dots in my emailaddress)

                    Comment

                    Working...