I' m trying to get notification for Mozilla. But it continuously throwing this error.
The Notification permission may only be requested from inside a short running user-generated event handler.
Here is my code. The same code is working fine on Chrome, EDGE and Opera.
Notification.requestPermission().then(function (status) {
if (status === 'denied') {
//
} else if (status === 'granted') {
//
}
});
I found some questions related to this, but none of those is helpful for me.