Biz & IT —

Mozilla developing Web push notification system for Firefox

Mozilla is developing a push notification system for Firefox that will allow …

Mozilla is developing a push notification system for the Firefox Web browser. It will allow users to receive notifications from websites without having to keep those sites open in their browser. The system will also be able to relay push notifications to mobile devices.

The project is part of Mozilla's broader effort to ensure that the Web is a competitive platform that can match the capabilities of native applications. Introducing support for push notifications will help to close the gap, because the feature is one of the major advantages that native mobile clients have historically offered over the browser for accessing Web services.

Mozilla developer Jeff Balogh described the new push notification system in a recent blog entry. The post sketched out a high-level overview of how the system might work and provided some sample JavaScript code.

"Push notifications are a way for websites to send small messages to users when the user is not on the site. iOS and Android devices already support their own push notification services, but we want to make notifications available to the whole web," he wrote.

The way that the system works is relatively simple. Mozilla or some other party would host a notification service that is capable of delivering messages to the browser. The service would have a unique URL endpoint for every active user.

The Web browser would provide a JavaScript API that websites can use to request permission from the user to send push notifications (such a prompt would be necessary to minimize spam). When the user grants permission, the browser hands the website the URL of the notification service endpoint associated with the user.

When a Web application sends a POST request with notification data to that endpoint, the notification service passes the message to the user. An instance of Firefox running on the user's desktop would likely maintain some kind of persistent connection to the notification service so that it could receive notifications instantly.

In addition, the notification service would hypothetically be able to relay messages to mobile devices. It could use Google's Cloud-to-Device messaging to send push notifications to mobile Firefox on the user's Android handset. Or it could use the Apple Push Notification Service to send notifications to users of Firefox Home, Mozilla's iOS application.

It's important to note that this push notification system is distinct from the existing desktop notification mechanisms that are already defined in pending standards. The desktop notifications that websites like GMail and Seesmic Web display to Chrome users, for example, will only work when the website is left open in a tab. Mozilla's push notification system moves beyond that limitation.

The push system is still at a relatively early stage of planning and isn't available to test yet. Balogh has defined the JavaScript APIs that the browser will use to enable the functionality and ask the user for permission to send notifications. He has also proposed the set of properties that will be associated with each individual notification that gets transmitted to the notification server.

Mozilla's push system will be especially useful for websites that want to send notifications to their users' smartphones without having to build a native mobile application. If the concept evolves into a standard, mobile browsers could someday potentially have the feature built in.

Listing image by Photograph by Smithsonian's National Zoo

Channel Ars Technica