Javascript setTimeout and redirect - IE freezes

后端 未结 3 1402
半阙折子戏
半阙折子戏 2021-02-15 13:17

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

3条回答
  •  伪装坚强ぢ
    2021-02-15 13:38

    Sounds as if IE is going into some form of "pause"-mode when you lock the screen, to avoid using cycles on rendering etc. Maybe you can try linking the redirection to the onFocus-event of the window, like this:

    window.onfocus = function(){
        window.location.href = "Test2.aspx";
    }
    window.location.href = "Test2.aspx";
    

    In theory, this should redirect the page as soon as focus is regained (ie when you unlock the screen). If the window already has focus, then this should not make any difference anyway.

提交回复
热议问题