Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

100
Vistas
Firebase messaging for web. Multiple tabs notifications

I'm using Firebase Messaging for browser notifications. Problem is when multiple tabs are open. Notification for every tab is shown. Adding tag to options didn't help

firebase.initializeApp(constants.CONFIG); 
const messaging = firebase.messaging();

messaging.setBackgroundMessageHandler(({ data }) => { 
  const options = { 
    body: data.body, 
    data: { link: data.link, }, 
    icon: data.icon, 
  };

  const backgroundNotification = self.registration.showNotification(data.title, options);

  return backgroundNotification; 
});

I need only one notification to be displayed even when many tabs with same app are open

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Comment this line of code

  const backgroundNotification = self.registration.showNotification(data.title, options);

and use instead

                new Notification(notification.title, {
                body : notification.body,
                tag : notification.title,
                icon : notification.icon
            });
  • Note that - Tag is unique, If you have 2 tabs and you are sending a push with name title: title1 and title1, it will show the push only ones.

Example 3.5: https://notifications.spec.whatwg.org/

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda