window.focus() not working in Google Chrome

后端 未结 16 1730
余生分开走
余生分开走 2020-11-28 05:07

Just wondering if Google Chrome is going to support window.focus() at some point. When I mean support, I mean have it work. The call to it doesn\'t fail, it jus

16条回答
  •  一整个雨季
    2020-11-28 05:22

    Maybe not what everyone wants either, but (in chrome) I noticed that an alert raised from the pop uped page keeps hold on the focus of the popup. So I'm doing this now...

    On the pop uped page, have a function loaded in the header:

    `
    

    And then on the pop uped page:

    
    

    So this is a variant of closing the popup when the focus is lost. But in my case, the popup is an edit window for data. A window, one doesn't want to close unasked. So now the user gets notified the focus is about to drop and gets a choice if he wants to close the window or not. Again, far from perfect, but it worked for me.

    (be gentle)

提交回复
热议问题