Link to home
Start Free TrialLog in
Avatar of Nugs
Nugs

asked on

Javascript popup based on application session timeout time.

Hey there guys,

I have been doing some searching on this and have found some scripts to do this but none of whihc seem to be accurate and variable to the appl;ication sessions timeout setting.

In my global.asax file on my application at the session_start portion of the site i emediatly set a few different session for use throughout the site. i wish to popup a alert window 60 seconds before my app sessions timeout.

Assume that i do not know the exact timeout minutes, what i am looking to do is pull this minute value from my app and into the javascript.

How please?

Nugs
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

So something like this:

<script>
var timeout = new Date();
timeout.setMinutes(timeout.getMinutes()+(<%= session.timeout %>-1)); // minutes I assume
var tId = "";
function check() {
  var now = new Date();
  if (now=>timeout) {
    clearInterval(tId)
    alert('One minute to timeout')
  }
}
tId=setInterval('check()',1000); // 1 second
</script>
Avatar of Nugs
Nugs

ASKER

I get a sytax error on this... from these lines?

...
        {
          var now = new Date();
          if (now=>timeout)
          {
...
 Nugs
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nugs

ASKER

thanks

Nugs