You can also set JavaScript timeout to session timeout through some code behind. Get it to run any JavaScript function you want. Very flexible, and you do not need to guess by checking the current time ... etc.
Something like that:
"window.setTimeout('yourJSFunctionGoesHere()', " + Session.Timeout + ");";
If you want to warn 2 minutes before you can do something like:
"window.setTimeout('yourWarningJSFunctionGoesHere()', " + Session.Timeout-2 + ");";
source share