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

393
Vistas
How to close an open window after the user has searched something in the open window(using JavaScript)?

I'm currently building a video game on the web, it's a millionaire. I came up with the idea that as one of the help, I would enable users to use google for 20 seconds. I managed to open a window with a search engine, but after 20 seconds I want to close it, this is not possible if the user has searched something.

newWindow=window.open('https://google.com','mywindow', 'width=375px, height=400px, top=200px')
setTimeout(() =>{
    newWindow.close()
},22000)

I also watched this tutorial: https://www.youtube.com/watch?v=2Qu8mwQizbM

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

0

Closing another window from JS should not be possible, as your code only has control of your tab. One way you could do what you're trying to do is to create an <iframe> then remove it after 20 seconds with setTimeout().

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