I am using 2.2 mozilla OS simulator for push notification. When i am going to register APP with OS , its saying Push Notifications are not supported. while debugging its found that navigator.push is coming as undefined. Following is the sample code snippet.
var registerPush = document.querySelector('#register-push');
if (registerPush) {
registerPush.onclick = function () {
if (!navigator.push)
return alert('Push notifications are not supported !');
var request = navigator.push.register();
request.onsuccess = function () {
console.log(request.result);
}
request.onerror = function () {
alert('Error getting a new endpoint !');
}
}
}
Aucun commentaire:
Enregistrer un commentaire