Web Notifications allow sites to display notifications to alert users outside the context of the webpage and the browser, keeping users informed of new messages or alerts and allowing sites to improve user engagement. Web Notifications in Microsoft Edge are fully integrated with the notification platform and Action Center in Windows 10, providing a consistent experience with other apps across the system and easy controls over permissions and Quiet Hours.
Sites are already beginning to support Web Notifications today, and we look forward to seeing this API become more popular. The implementation in Microsoft Edge is based on the W3C Web Notifications specification, now supported broadly across modern desktop browsers. Each notification is associated with a title, a notification body, a language setting, a text rendering direction attribute, a tag attribute, an icon URL, and the webpage origin. Microsoft Edge also supports the event model as defined by the W3C spec, including all the show, click, close, and error events. Notifications can only be displayed if the user has granted permission to the specific domain sending the notification.
Implementation details
Microsoft Edge calls the Windows Notification Platform API to pass the notification from the webpage to the Notification Platform, which will in turn render and manage notifications in a consistent way across all Windows apps.
We strongly recommend that web developers should include an icon in each notification. The icon should provide value to the specific notification. For example, a profile photo can help users quickly identify the source or the sender of the notification message. If an icon is not provided, Microsoft Edge will apply a default icon.
When the user clicks on an on-screen notification, Microsoft Edge brings the corresponding window and tab into focus, and the webpage will receive the corresponding click event and can update accordingly. On-screen notifications that are not clicked or not closed immediately by the user will be minimized to the Windows Action Center, where they are grouped under the “Microsoft Edge” heading in chronological order. To ensure notifications are passed into the Action Center, you can avoid explicitly calling the close()
method on the notification object.
When the user clicks on a notification in the Action Center, Microsoft Edge will launch a tab and navigate to the corresponding origin of the notification. Since the notifications are not persistent, no event is fired to the webpage. When a notification initially originated from an iframe, Microsoft Edge will open a tab based on the domain of the top-level parent page.
Permissions
When a user visits a website that uses the Web Notification API, Microsoft Edge will prompt the user for permission to show notifications:
Once granted permission, the website will be allowed to send desktop notifications – in the Skype example shown above, the site will send notifications for each incoming call and each incoming IM. These settings persist when visiting the same website domain again – users can manage permissions per domain at any time under the Advanced Settings menu.
Notifications can be disabled for a domain or for all of Microsoft Edge in Action Center simply by right-clicking on a notification.
Notifications that originate from sites in an InPrivate window will not be stored in Action Center, and permission settings for those domains will not be saved after each session.
What’s next
In the future, we plan to evolve this implementation with additional features to further improve user control and notification fidelity. In a later release, we plan to group notifications in the Action Center based on website domains, to preserve the site context of each notification.
We are also collecting telemetry in this release to better understand how users interact with notifications; for example, we currently save notifications in the Action Center for up to seven days, but will continue to evaluate the optimal duration so the Action Center doesn’t get crowded.
Finally, as we continue to prototype support for Service Workers and Push API in the EdgeHTML platform, we’re investigating the potential for notifications when the browser is not active or the origin webpage is not loaded. This will also enable notification support on Windows 10 Mobile devices and enable persistent notifications in the Action Center, so that when clicked, the corresponding Service Worker can be invoked to take action.
We will share more details on these changes as we make progress along the way and our prototypes continue to evolve. As always, you can track the status of EdgeHTML platform features under consideration on Platform Status, and we look forward to your feedback!
― Shijun Sun, Principal Program Manager, Microsoft Edge
― Adam Barrus, Senior Program Manager, Microsoft Edge