Changing Notification permissions for a given website?

Hi there,
I’m trying to change the Notification permissions for a given website.
I was able to fetch the current permission via:
const result = await browser.tabs.executeScript(tabId, {code:'Notification.permission'});

I’m not sure however how to set the Notification permission for a given website…?

Thanks a lot in advance!

Hi,

The ‘permission’ property is read-only. It indicates the current permission granted by the user.

Only the user can change this permission. The user prompt can be shown via https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission

Is there a way to temporarily block Notifications coming from a specific tab (programmatically, of course)?

Sure, you can overwrite the notification APIs and ignore the calls. Note that this does not work for service workers.

Example content script that intercepts the notification APIs: