Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

135
Visualizações
Isn't the JavaScript Notificaiton API useless at this point?

So I read on MDN that the Notification API can only be used on an event initiated by the user. Doesn't this take away any need for this API at all? I can't think of any situation whatsoever where posting a Notification would ever be useful within a user event.

User hits a button: "Hey user, you hit a button! I'm telling you something you already know in the most obnoxious way possible! Hee hee. ^_^"

Are they just deprecating this, or is there still some functionality to it? Am I missing something?

I want to use it to actually notify the user that a note-worthy change has occurred in the state of the application. This is apparently now not a supported use case. Huzzah!

Update:

https://developer.mozilla.org/en-US/docs/Web/API/notification

Quote: "Note: In the above example we spawn notifications in response to a user gesture (clicking a button). This is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture. Firefox is already doing this from version 72, for example."

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You've misread MDN.

https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API

Because of abuses of push notifications in the past, web browsers and developers have begun to implement strategies to help mitigate this problem. You should only request consent to display notifications in response to a user gesture (e.g. clicking a button). This is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notification permission requests not triggered in response to a user gesture. Firefox is already doing this from version 72, for example, and Safari has done it for some time.

This only affects the initial prompt to allow notifications.

A screenshot of the notifications prompt

Subsequent uses of the Notifications API (once the user selects 'allow') don't require user interactions.

about 4 years ago · Juan Pablo Isaza Relatório

0

There is a use such as you can make it say stuff you don't know, for example if you forgot your first passkey then you type in your second passkey to see your first passkey, or you can make it say something secret with it in some secretive game such as a ARG.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda