Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
¿Cómo hacer que la notificación push abra la aplicación Chrome al hacer clic? (Node.js, empuje web)

Estoy usando web-push para implementar notificaciones push en mi aplicación web, estoy tratando de descubrir cómo abrir la aplicación Chrome (o el navegador que están usando) cuando hacen clic en ella. Entonces, en este momento, lo mejor que pude hacer fue que al hacer clic se abrirá un enlace que no me gusta, ya que abre una nueva pestaña con la aplicación y empiezo a recibir notificaciones duplicadas.

 console.log("Service Worker Loaded..."); var usuario self.addEventListener("push", e => { const data = e.data.json(); usuario = data.usuario self.registration.showNotification(data.title, { icon: "/images/icon.png" }); }); self.addEventListener('notificationclick', function(event) { event.notification.close(); event.waitUntil(self.clients.openWindow('https://fimsa-sistema-vales.herokuapp.com/vales/' + usuario)); }, false);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

También soy muy nuevo, pero encontré esto que podría ayudar a intentar pegar este código.

 self.addEventListener('notificationclick', function(event) { console.log('On notification click: ', event.notification.tag); event.notification.close(); // This looks to see if the current is already open and // focuses if it is event.waitUntil(clients.matchAll({ type: "window" }).then(function(clientList) { for (var i = 0; i < clientList.length; i++) { var client = clientList[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openWindow) return clients.openWindow('/'); }));

Lo obtuve de https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/notificationclick_event``

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!