Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is there any way to check by javaScript whether a session is timeout? If it is possible in javascript, can any one help me with the code snippet?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
203 views
Welcome To Ask or Share your Answers For Others

1 Answer

if you mean a server session, then no - it can't be done properly.

You could initialise a timer to the same value as the server session - if the timer executes then the user has been on the same page long enough for the server session to expire, but that doesn't actually check if the session is expired, it merely tries to guess.

Alternatively, you could do an asynchronous call to a URL on the server, but on most servers this will automatically extend the session - if the call succeeds, then the session is active...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...