Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect blocked notifications on Edge

Is there a way to detect that the notifications were automatically blocked by Edge?

Recently, instead of seeing the native dialog box to allow or block notifications, I only see that tiny button, which when clicked explains that the notifications are blocked:

enter image description here

Most users won't notice that tiny button and won't understand why the notifications are not allowed.

I have a code that has been working well for more than a year on Firefox and Chrome. It also used to work on Edge, but recently, Edge only displays that tiny button.

My code works as follow:

  • I first display a "Do you wish to receive notifications?" message
  • Then if the user clicks "Yes", I call worker.pushManager.subscribe which should display the native dialog box from the browser to allow or block notifications.

The problem is that, at least with Edge 112, the subscription never returns, and I don't get any error:

try {
    const sub = worker.pushManager.subscribe({
        userVisibleOnly: true,
        applicationServerKey: key
    });

    const result = await sub;

    // Edge never reaches here
    return result;
} catch (error) {
    // Edge never reaches here
}

So is there a way to detect that the notifications were automatically blocked by Edge, so that I can mention the tiny button the user should click?

like image 389
user276648 Avatar asked Dec 05 '25 18:12

user276648


1 Answers

I think that's Edge's Quiet notification requests.

I tried many ways but seems that we can't detect the "Quiet notification requests". Usually, we use Notification.permission to check the permission values, but the value doesn't change and it's always default when the notification is blocked quietly.

There's little we can do about it. The way you mention to detect Edge and show a reminder can be a workaround. Besides, you can also provide feedback to Edge team by pressing Alt+Shift+I in Edge if you have any suggestion about the "Quiet notification requests".

like image 198
Yu Zhou Avatar answered Dec 11 '25 02:12

Yu Zhou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!