Is there a cross-browser method to bring a popup window into the foreground?

二次信任 提交于 2019-12-13 03:42:24

问题


I have a chat in a popup browser window. This chat page (ASP) checks for new messages every 10 seconds.

I would like to bring this popup window to front when there is a new message. I tried with "window.focus()", but this work only in few version of IE.

Are there other options to achieve my goal?


回答1:


Don't steal the focus.

And no, it will work only in some IEs, as you said. Quoting Mozilla's developer network,

It may fail due to user settings and the window isn't guaranteed to be frontmost before this method returns.

This is valid for all modern browsers, I guess.

You can use the following approach in order to notify the user of an activity.



来源:https://stackoverflow.com/questions/1464840/is-there-a-cross-browser-method-to-bring-a-popup-window-into-the-foreground

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!