I’m working on implementing web push notifications and have encountered an issue where Notification.permission returns ‘denied’ in Firefox, even though notifications were previously allowed.
Here’s the relevant code I’m using to request notification permissions:
if ('Notification' in window) {
Notification.requestPermission().then(function(permission) {
console.log('Notification permission:', permission);
}).catch(function(error) {
console.error('Error requesting notification permission:', error);
});
} else {
console.log('Notifications are not supported in this browser.');
}```
Browser Version: Firefox [specific version]
OS: [your operating system]
Framework: [if applicable]
What I’ve Tried:
Checked and cleared permissions in Firefox settings.
Tested in a new Firefox profile.
Ensured the code runs after user interaction.
Verified that the site uses HTTPS.
Error Message: When running the code, the console logs 'denied' even though I’ve previously allowed notifications for this site.
Does anyone know why this might be happening or how I can resolve this issue?