function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
atallatall 

Displaying the time in VF Page

Displaying the time in VF Page in such a way that

 

a message has to be displayed "Your Page will logout in another 05:00 minutes"

 

where this 05:00 minutes has to decreased for every second (ex:05:00 to 04:59 in another second, 04:59 to 04:58 in another one more second etc) and at last it has to be reached 00:00 seconds then page has to logout.

 

If the above condition is possible, my another requirement is that last 10 seconds has to show in red color

 

Thanks for your help

 

Please let me know if you have any questions.

sfdcfoxsfdcfox

You can do this in JavaScript. You'll need to just mark the end time, and call a timer function once per second to render the remaining time (or log the user out on expiration). Something like this: http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/190455/help-required-for-using-timer-control-created-in-javascript. There's millions of ways this can be done, and there's nothing magical you need to do in respect to Visualforce. There's already a timer logout function, by the way, that's built into any page that has the headers displayed. It's controlled by the "Session Expiration" timer as configured in your organization's setup screen. You should note that this value is the ultimate limiter of how long a session can last, so if your logout function's timer exceeds the standard logout timer, it won't matter anyways.