Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mozilla Notification API
var notification = navigator.mozNotification;
if (notification && notification.requestRemotePermission) {
// Ask the user to allow notifications.
var request = notification.requestRemotePermission();
request.onsuccess = function() {
var url = request.result;
console.log('New push URL: ' + url);
// We got a new push URL, store it on the server.
jQuery.post('/push-urls/', {url: url});
};
}
var notification = navigator.mozNotification;
if (notification && notification.requestRemotePermission) {
// Ask the user to allow notifications.
notification.requestRemotePermission(function (result) {
var url = result.url;
console.log('New push URL: ' + url);
// We got a new push URL, store it on the server.
jQuery.post('/push-urls/', {url: url});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.