Notification permission denied — why can’t my site show browser notifications?

The page could not get permission to show browser notifications. Check Notification.permission and the page context before requesting again. If the user already denied it, the interface should respect that choice and offer an in-page way to see updates.
When permission is undecided, explain what alerts the feature sends and request permission after the user chooses to enable them. Check that the browser provides the API in the current context. For a denied state, show the available alternative and explain where users can change settings if they choose.
Test how the page behaves after a denial and after a reload. Users should still be able to follow the event that matters without being prompted repeatedly.
document.querySelector('#enable-alerts')?.addEventListener('click', async () => { if (!('Notification' in window)) return; const result = await Notification.requestPermission(); console.log(result); });
Test the alerts button with default and denied permission states and check what the page offers in each case.