CloudServices/Notifications/Specification/BrowserJS: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
 
(No difference)

Latest revision as of 19:51, 19 November 2013

The following is the JavaScript API to be exposed by the browser to allow web apps to request permission to send notifications.

navigator.pushNotifications.requestPermission(
    {"app_name": "GMail",
     "account": "sdasilva@gmail.com"}, 
    function callback({token, encryptionKey, hmacKey, serverURL}) {
        ...
    }
);

Once the client has added the subscription to the notification service, it will call the callback function, passing back the token, encryption key, and POST Office serverURL to send notifications to.