Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Desktop notifications plugin for Chrome, Safari, Firefox and IE9+
HTML5 Desktop Notifications is a GitHub-hosted JavaScript library that gives web pages a consistent, standards-based API for displaying desktop notifications across Chrome, Firefox, Safari, Edge, and IE9+.
It is a client-side polyfill and wrapper around the W3C Notification API. The library takes a notification title and an options object, then creates a native desktop notification through the browser's built-in API when available, and falls back to an internal custom implementation when the API is missing. It runs entirely in the browser, requires no server-side components, and is maintained by ttsvetko in the public GitHub repository ttsvetko/HTML5-Desktop-Notifications.
notsupported permission level on top of the standard default, granted, and denied states, so code can detect when notifications cannot be displayed at all.Notification.requestPermission() returns a Promise; for IE9 and IE10 a Promise polyfill must be supplied separately because this library does not bundle one.new Notification('title') returns the browser's native Notification object, while window.Notification is replaced with the polyfill class.Web developers who need to deliver desktop notifications to users on a range of browsers, especially those who must still support legacy versions like IE9 and IE10. It is also useful for teams that want one codebase for notification logic instead of maintaining browser-specific prefixes and fallbacks.
After including the script, call Notification.requestPermission() to ask the user for permission, then create a notification with new Notification('title', options). The library inspects the current browser and directs the call to the native implementation or to its own polyfill transparently.
IE9+, the latest Edge from the Windows 10 Anniversary Update, Firefox 22+, and Google Chrome 32+. Safari is partially supported but does not display the icon you provide.
Yes. The method returns a Promise, which means IE9 and IE10 require a Promise polyfill to be loaded separately because it is not included in this library.
For IE, the icon path must be a .ico file containing a 16x16 icon at 96 dots per inch. The library automatically appends .ico to the icon name if it isn't already present, but the resource file itself must meet those dimensions.
No. Service Worker support is listed in the repository's TODO list as an unimplemented feature, so notifications cannot be shown from a background service worker yet.
