How can I know if browser notifications are blocked by Windows How can I know if browser notifications are blocked by Windows windows windows

How can I know if browser notifications are blocked by Windows


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.


Only for secure websites, there is a way! You could use :

    if (!("Notification" in window)) {    alert("No");  }

What this would do, is if desktop notifications are disabled, it would display an alert saying "no".

In some other cases where this wouldn't work, you could use

    if (Notification.permission !== 'granted')        Notification.requestPermission();    }