I have a script on my page that is dealing with session timeouts, redirecting the user on the client side when the session is due to expire. The complete code is somewhat more complex, but I have trimmed down the code to what is causing me the issue:
<head runat="server">
<script src="javascript/jquery-1.7.2.min.js" type="text/javascript">
</script>
<script type="text/javascript">
/*
Please see document ready method at the bottom that sets
up this code, calling CheckActivity() at intervals.
*/
var warningInterval, redirectTimeout;
var now = 1;
function TimeoutRedirect() {
window.location.href = "Test2.aspx";
}
//In this example this is a bit of a null op, but in real
//code this will display a warning a minute or so prior to redirect.
//This is required to recreate...
function CheckActivity() {
if (now > 4) {
clearInterval(warningInterval);
redirectTimeout = setTimeout(function () {
TimeoutRedirect(); }, 5000);
}
//Some visual activity for testing purposes.
$("#CheckActivityCount").text(now);
now++;
}
$(document).ready(function () {
warningInterval = setInterval(function () {
CheckActivity(); }, 1000);
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="CheckActivityCount">
</div>
</div>
</form>
</body>
This code works as expected, redirecting after (roughly) ten seconds. However, if after the interval calls to CheckActivity have finished (after 5 seconds), I lock my screen and then unlock it after the redirect has due to have happened (another 5 seconds), the URL in my IE window has gone to 'test2.aspx', but the window seems to have frozen (still showing the first page).
This eventually un-freezes, but it takes 10s of seconds to get to the next page.
This only seems to happen in IE (IE9 on my machine), and is fine in chrome and firefox (and oddly IE6).
(Test2.aspx is a very simple page, only containing the text 'success'.)
Just noting that if I change the redirect from test.aspx to http://www.google.com/, this does not seem to be a problem. Still does not work however if I change the test2.aspx to be an absolute URL (the only main difference being that this would be a localhost address).