是否有用于跨浏览器桌面通知的 JavaScript 库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4104016/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 10:22:43  来源:igfitidea点击:

Are there any JavaScript library for cross browser desktop notification?

cross-browsernotificationsjavascript

提问by Soul_Master

I know W3C just publish their draft version of Web Notification to notify user. So, there is no browser that implement this method in their current or latest build browser.

我知道 W3C 只是发布他们的 Web 通知草案版本来通知用户。因此,没有浏览器在其当前或最新构建的浏览器中实现此方法。

Web Notifications Overview

Web 通知概述

After I search a lot of webs for finding all possible desktop notification in most browser.I found any 2 major browser that should support this.

在我搜索了很多网站以在大多数浏览器中找到所有可能的桌面通知之后。我找到了任何 2 个应该支持这个的主要浏览器。

1.Google Chrome and Webkit-based browser

1. Google Chrome 和基于 Webkit 的浏览器

Notification of Windows
(source: google.com)

Windows 通知
(来源:google.com

Notification of Mac
(source: google.com)

Mac 的通知
(来源:google.com

Notification of Linux
(source: google.com)

Linux的通知
(来源:google.com

We can use native Desktop notification function to show message like the following picture.

我们可以使用本机桌面通知功能来显示如下图所示的消息。

More infomation: The Chromium Projects - Desktop Notifications

更多信息:Chromium 项目 - 桌面通知

2.Internet Explorer

2.浏览器

For IE 5.5+, we can use createPopup function to notify use like in Google Chrome but it's much flexible more that Google Chrome.

对于 IE 5.5+,我们可以使用 createPopup 函数来通知使用,就像在谷歌浏览器中一样,但它比谷歌浏览器灵活得多。

Create Popup

创建弹出窗口

More information: CreatePopup Method on MSDN

更多信息:MSDN 上的 CreatePopup 方法

Moreover, if we pin website to Windows 7 taskbar, we can use overlay icon to notify user too.

此外,如果我们将网站固定到 Windows 7 任务栏,我们也可以使用覆盖图标来通知用户。

Overlay Icon
(source: microsoft.com)

叠加图标
(来源:microsoft.com

More information: IE9, Site Specific Browsers, and adding your own Jump List Items to Pinned Tabs

更多信息:IE9、站点特定浏览器,以及将您自己的跳转列表项添加到固定选项卡

Other browser

其他浏览器

I think we can use Pines Notify jQuery plugin to create in-browser notification.

我认为我们可以使用 Pines Notify jQuery 插件来创建浏览器内通知。

Pines Notify

松树通知

Or do you have any desktop notification library or idea for suggesting me?

或者你有任何桌面通知库或建议我的想法吗?

Thanks,

谢谢,

PS. If it does not have fine library, I will create it with myself.

附注。如果它没有好的库,我会自己创建。

Update I

更新我

Since IE8, it does not allow us to display popup outside current browser. For example, when IE is minimized, all popups are not displayed. So, Google Chrome is only one browser that has fully web notification API (FF 4 also has non-documented web notification API but it not work for now).

从 IE8 开始,它不允许我们在当前浏览器之外显示弹出窗口。例如,当 IE 最小化时,不会显示所有弹出窗口。因此,Google Chrome 浏览器只是一种具有完整网络通知 API 的浏览器(FF 4 也有未记录的网络通知 API,但目前无法使用)。

回答by Eamon Nerbonne

I don't know of a cross-browser lib; but desktop-notifications are coming to Mozilla Firefox post 4.0 as well. They're implemented in trunk already: https://bugzilla.mozilla.org/show_bug.cgi?id=573588

我不知道跨浏览器库;但是桌面通知也将在 Mozilla Firefox 4.0 之后出现。它们已经在主干中实现了:https: //bugzilla.mozilla.org/show_bug.cgi?id=573588

Though apparently this new feature won't get included in FF 4.0: https://bugzilla.mozilla.org/show_bug.cgi?id=594543

虽然显然这个新功能不会包含在 FF 4.0 中:https: //bugzilla.mozilla.org/show_bug.cgi?id=594543

But in the long term, an api related to but different from the webkit will be available.

但从长远来看,一个与 webkit 相关但又不同的 api 将可用。

Not sure about opera, however.

然而,不确定歌剧。

回答by desbest

I doubt that there are any cross-browser desktop notification javascript libraries, because those notifications are vendor specific implementations, made by the web browsers themselves, and not the W3C or WHATWG.

我怀疑是否有任何跨浏览器桌面通知 javascript 库,因为这些通知是特定于供应商的实现,由 Web 浏览器本身制作,而不是 W3C 或 WHATWG。

CreatePopup looks like it was made for enterprise web applications as it never took prominence, and Google wants web applications to replace desktop applications. Jumplists are just a way to provide Windows 7 functionality into IE9, but it's not a move to push to cloud computing.

CreatePopup 看起来像是为企业 Web 应用程序而设计的,因为它从来没有出现过,谷歌希望 Web 应用程序取代桌面应用程序。Jumplists 只是向 IE9 提供 Windows 7 功能的一种方式,但它并不是推动云计算的举措。

回答by Beachwalker

The dojo toolkit http://www.dojotoolkit.orgcontains a control called "Toaster" in its dojox package, but this is a notification inside the browser window and does not follow the web notifications specification. Maybe it is also a solution for your webapp.

dojo 工具包http://www.dojotoolkit.org在其 dojox 包中包含一个名为“Toaster”的控件,但这是浏览器窗口内的通知,不符合 Web 通知规范。也许它也是您的 webapp 的解决方案。