Is there a cross-browser method to bring a popup w

2019-08-21 07:12发布

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条回答
甜甜的少女心
2楼-- · 2019-08-21 07:40

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.

查看更多
登录 后发表回答