How can I know if browser notifications are blocked by Windows

Viewed 581

My web app sends browser notifications, and I know how to check the browser permission for the notifications, and how to request permissions if they are not granted. However, even if the user granted permission for my site to send notifications, she might still not get the notifications, because they might be disabled (either globally on Windows, or for the current browser).

Is there a way for me to detect this and let the user know that notifications won't be displayed unless she enables them in Windows Settings?

1 Answers

There's no way to do!

There's no way to do this, JavaScript doesn't have direct access to Windows to detect settings, or to change in Windows Settings.

I am pretty sure it's made to protect users privacy.

The only affected browsers by Windows Settings are Chromium built browsers.

If you turn Notifications settings off in Windows, Google Chrome and Microsoft Edge (aka Chromium browsers) won't be able to send Notifications while other browsers like Firefox that are built on different engines will be able to send Notifications.

Which means that Google Chrome and Microsoft Edge uses a different way to address notifications:

Google Chrome:

Google Chrome

Microsoft Edge:

Microsoft Edge

While Firefox has a completely different way and UI:

Firefox

Summarize:

JavaScript can't detect whatever Notifications settings is enabled or not in Windows settings. And if Notifications settings are disabled, browsers like Firefox can still send notifications.

Related