PushManager.register

This article is in need of a technical review.

Non-standard
This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

This API is available on Firefox or Firefox OS for installed or higher privileged applications.

Summary

The register method is used to ask the system to request a new endpoint for notifications.

Syntax

var request = navigator.push.register();

Return

A DOMRequest object to handle the success or failure of the method call.

If the method call is successful, the request's result will be a string, which is the endpoint URL.

Note: if you do not need the URL any more, please use Pushmanager.unregister() to clean up after yourself.

Example

var req = navigator.push.register();

req.onsuccess = function(e) {
  var endpoint = req.result;
  debug("New endpoint: " + endpoint );
}

req.onerror = function(e) {
  debug("Error getting a new endpoint: " + JSON.stringify(e));
}

Specification

Specification Status Comment
Push API Working Draft Defines the PushManager interface.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support Not supported Not supported Not supported Not supported Not supported
Feature Android Firefox OS Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported 1.1 Not supported Not supported Not supported Not supported

Gecko implementation note

This API is currently available on Firefox OS only for any installed applications.

See also

Document Tags and Contributors

Contributors to this page: nikhilm, Willyaranda, Jeremie, kscarfone
Last updated by: kscarfone,