是否有一个跨浏览器方法将弹出窗口放到前台? [英] Is there a cross-browser method to bring a popup window into the foreground?

查看:738
本文介绍了是否有一个跨浏览器方法将弹出窗口放到前台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在弹出式浏览器视窗中进行即时通讯。此聊天页面(ASP)每10秒检查一次新邮件。

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

当有新消息时,我想将此弹出式窗口设置为前面。我尝试用window.focus(),但这只工作在少数版本的IE。

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?

推荐答案

不要偷焦点

不,它只会在某些IE,如你所说的。引用 Mozilla的开发人员网络

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.

这篇关于是否有一个跨浏览器方法将弹出窗口放到前台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆