导致浏览器发出警报的 Web 应用程序?
我不确定如何问这个问题,因为我不确定应该使用的术语。我正在编写一个 Web 应用程序,它本质上是一个基于浏览器的 IRC 客户端。我希望复制我在 x-chat 等客户端中看到的一些功能,当您收到个人消息时,它会提醒窗口管理器。在我的窗口管理器(Aweosme wm)中,它将程序选项卡变成红色,在 Windows 中,我想这会导致任务栏上的程序按钮闪烁。
本质上,它是一个通知,告诉窗口管理器发生了一些事情并且程序需要您的注意。
- 这个的术语是什么 功能?
- 是否可以 让一个 webapp 告诉浏览器做什么 这?
- 如果“B”是肯定的,那又如何呢?
I am not sure exactly how to ask this question as I am not sure of the terminology I should use. I am writing a web application that is essentially a browser based IRC client. I wish to replicate some functionality I see in clients like x-chat where when you get a personal message it will alert the window manager. In my window manager (Aweosme wm) it turns the program tab red, in windows I imagine it would cause the programs button on the task bar to blink.
Essentially it's a notification that tells the window manager that something has happened and the program wants your attention.
- What is the terminology for this
functionality? - Is it possible to
make a webapp tell the browser to do
this? - If 'B' is yes then how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您实际上无法让浏览器窗口在任务栏中闪烁。针对 HTML5,已计划推出通知 API,到目前为止,Chrome 支持它,但似乎又被删除了。
引起用户注意的唯一跨浏览器可能性是设置窗口的焦点:
或更改页面的标题:
另请参阅this SO 答案,用于更改
document.title
的一个很好的“blinky”实现。You can't really make your browser window blink in the task bar. For HTML5 a Notification API was planned and so far Chrome supports it, but it seems that it was dropped again.
The only cross-browser possibilities to get the attention of your users are either to set the focus of the window:
or to change the title of your page:
See also this SO answer for a nice "blinky" implementation of changing
document.title
.您没有用于在网络应用程序中使用通知的 API。只是因为不同的操作系统中有很多不同的通知系统(Mac OS X 中的 Growl、MS Windows 中的系统托盘通知以及 Linux 中的多个窗口管理器 API)。在 Mac OS X 和 Linux 中,默认情况下,您没有安装任何通知系统。
You don't have an API to use notifications in webapps. Just because there are a lot of different notification systems in different OS (Growl in Mac OS X, system tray notifications in MS Windows and several window managers API in Linux). In Mac OS X and Linux, by default, you don't have any notification system installed.