You could, but we're making this change because our user studies show users
respond negatively to unexpected and unwanted prompts. If the users don't
associate their triggering interaction with a desire to accomplish the task
for which you're requesting permission they're still going to say "No"
Let‘s assume that I want to show the notification prompt on my website as soon
as possible. If I register event handlers for all click, tap, and key press
events on the page, I should be able to trigger the notification prompt on the
first such event from within the event handler, correct?
Starting from version 72, Firefox will require a user gesture when calling
Notification.requestPermission()  and PushManager.subscribe() .
Requests that do not follow a user gesture will be automatically denied. We
will, however, show a small UI indicator that can be used by Firefox users
Mail list logo