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

130
Views
Cómo hacer que el navegador de escritorio vuelva a estar en primer plano cuando se minimiza a través de una notificación automática

Estoy tratando de llevar los navegadores de escritorio como Firefox, Chrome, Brave, etc. a la vanguardia cuando se hace clic en una notificación automática.

EDITAR: Tan pronto como publiqué este comentario, pensé en eliminar event.preventDefault(); y eso funcionó para hacer la ventana emergente, pero se abre en una nueva pestaña y no se selecciona.

Tal como está con este código, la página se abre pero se abre en una nueva pestaña que no está seleccionada. Digamos que minimizo Firefox y empiezo a trabajar en el bloc de notas o GIMP; Quiero hacer clic en una notificación automática y luego hacer que vuelva a poner el navegador en primer plano con la nueva pestaña seleccionada también.

Jquery o Javascript funcionarán si puedo lograr mi objetivo.

Además, no quiero que esto abra una nueva instancia del navegador; Quiero que el código use la instancia del navegador existente pero que aparezca con mi enlace seleccionado.

Aquí está mi código hasta ahora, y no logra mi objetivo:

 function sendPush(pushTitle, pushBody, pushUrl) { // pushTitle is the title, pushBody is the body, pushUrl is the link that will be opened when the push notification is clicked // check if the browser supports push notes if (!("Notification" in window)) { console.log("This browser does not support desktop notification. To get push notifications use a chromium based browser or mozilla based browser"); } // generate and send the push notification else if (Notification.permission === "granted") { var notification = new Notification(pushTitle,{ onshow: null, onerror: null, onclose: null, title: pushTitle, dir: "auto", lang: "", body: pushBody, tag: "", icon: pushIcon }); } // add the onclick listener to make the notification interactive and open a link if (notification){ notification.onclick = function(event) { // if I remove this it works but doesn't select the new tab //event.preventDefault(); // I tried removing _blank and that didn't work window.open(pushUrl, '_blank'); // I tried doing window.focus() but it doesn't work window.focus(); } } }

¿Cómo puedo volver a poner la ventana del navegador en primer plano si está en segundo plano debido a una notificación automática?

He buscado en google y duckduckgo extensamente pero no encontré nada que funcione. ¿Es esto posible?

EDITAR: si event.preventDefault(); trae la ventana al frente, pero la pestaña no está seleccionada cuando aparece la ventana. ¿Alguna forma de abrir una nueva pestaña Y aparecer al mismo tiempo?

about 4 years ago · Juan Pablo Isaza
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!