Javascript setTimeout and redirect - IE freezes

后端 未结 3 614
礼貌的吻别
礼貌的吻别 2021-02-15 13:09

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:21

    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.

提交回复
热议问题