Consider the following.
if (this.Notification) {
Notification.requestPermission(function(permission) {
if (permission === 'granted') {
return new Notification('hi this is a test');
} else {
return alert("Notifications not permitted");
}
});
} else {
alert('Notifications not supported');
}
This seems to behave as expected in Chrome on desktop. In Firefox for Android, such notifications appear in the Android notification bar.
However on Android Chrome it seems to prompt the user to allow/disallow notifications, but if the user clicks 'allow' nothing seems to happen. Does Android Chrome support this sort of notification?
EDIT: This is different to this question from 18 months ago - then window.Notification
wasn't defined at all. Now it is defined but doesn't seem to do anything.