弹出窗口始终位于顶部

问题描述:

我正在研究可能使窗口始终位于顶部的任何黑客(除了window.focus())之外。也许一个隐藏的文本框,我可以设置焦点等。

Am looking at whatever hacks that are possible to keep a window always on top (apart from window.focus()). Maybe a hidden textbox to which I can set focus etc.

每当有新消息到达时,我都会在LivePerson(支持)中看到这种情况。我有合法的使用这个,而不是惹恼用户广告或任何东西。

I see this happening in LivePerson (support) whenever a new message arrives. I have legitimate use of this and not to annoy users with ads or anything.

任何浏览器的任何黑客都会做。我不是在寻找一个完整的跨浏览器解决方案。我认为window.focus可以用于Internet Explorer,但我还没有测试它。

Any hacks for any browsers will do. I am not looking at a complete cross-browser solution. I think window.focus would work for Internet Explorer, though I am yet to test it.

此JavaScript代码将放置弹出窗口在所有其他打开的浏览器窗口之上,直到查看器关闭包含这个小JavaScript代码的窗口:

This JavaScript code will place the popup window on top of all other open browser windows until the viewer closes the window containing this little JavaScript code:

<body onblur="self.focus();">