10

By default, Firefox displays Web Notifications for about half a minute before automatically hiding them.

Is there a way to increase the amount of time that they are displayed before auto-hiding them?

Alternatively, is there a way to prevent them from auto-hiding at all?

1
  • 1
    After much digging around, I finally found evidence that confirms it's hardcoded to 20 seconds: dxr.mozilla.org/mozilla-release/…. Will continue looking for a way to change this though
    – MC10
    Commented Mar 18, 2019 at 21:00

1 Answer 1

12

In Firefox, notifications are hardcoded to close after 20 seconds. To allow notifications to stay open indefinitely until the user closes them, toggle the dom.webnotifications.requireinteraction.enabled flag. Navigate to about:config in the address bar to do this.

The default value for dom.webnotifications.requireinteraction.enabled is false so it does not require user interaction to dismiss notifications. Set this to true.

Now the caveat is, the service sending the notification also has to use the requireInteraction property for this setting to have any effect.

You can test it here: https://googlechrome.github.io/samples/notifications/requireInteraction.html. One of the notifications disappears after 20 seconds and the other stays open. If the dom.webnotifications.requireinteraction.enabled flag is set to false, both will close after 20 seconds.

5
  • 1
    Thanks so much! I made a small edit to your great answer. If for any reason the edit is not in line with the facts, please revert or edit. Thanks again! Commented Mar 18, 2019 at 23:08
  • MDN has a code example slightly simpler the the provided link here: developer.mozilla.org/en-US/docs/Web/API/Notification/… Commented Jul 5, 2021 at 21:20
  • This works for me, but after 20 seconds, when I click the notification, it closes...it doesn't opet the link in the notification. How to fix that? Commented Jul 2, 2022 at 10:34
  • As of a recent update, it appears that the default has been changed to true, I've had to manually set it to false as YouTube is sending updates that don't disappear automatically but other sties are working normally.
    – Tarquin
    Commented Sep 5, 2023 at 22:32
  • This seems to still be a problem in Firefox and it drive me crazy. I have it up-to-date to the last version and doesn't matter what the value if for requireinteraction.enabled the notifications go away after 3s. The testing one does not even show both, only one of them shows up at times and does matter which one wins, it goes away after 3s. Tested in Chrome, works as expected. No idea what else can be done. Commented May 2 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .