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

125
Views
redirigir al usuario después de hacer clic en la notificación con js

Estoy usando este código para enviar notificaciones a mi usuario:

 Notification.requestPermission(function(result) { if (result === 'granted') { navigator.serviceWorker.ready .then(function(registration) { registration .showNotification('new message from ' + message.user, { body: message.message, vibrate: [200, 100, 200, 100, 200, 100, 200], tag: 'message' }); }) ; }else { alert('new message from ' + message.user + '\n please allow notification to get notification when a message receive.') } });

¿Cómo redirigir al usuario a una URL específica después de hacer clic en la notificación?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intento esto y trabajo, espero que sea útil para otros.

 Notification.requestPermission(function(result) { if (result === 'granted') { navigator.serviceWorker.register('/sw.js'); navigator.serviceWorker.ready .then(function(registration) { registration .showNotification('new message from ' + message.user, { body: message.message, vibrate: [200, 100, 200, 100, 200, 100, 200], tag: 'message', data : {email: message.email} }) ; }) ; }else { alert('new message from ' + message.user + '\n please allow notification to get notification when a message receive.') } });

y en el archivo 'sw.js' agregue esto:

 self.addEventListener('notificationclick', function(event) { clients.openWindow('url'); event.notification.close(); }, false);
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!