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

99
Views
La propiedad Window.closed no funciona con Facebook

Necesito saber cuándo el usuario cierra una ventana.

Uso la propiedad de javascript Window.closed . Este código funciona perfectamente para todos los sitios web, excepto cuando cargo facebook.com en la ventana. Entiendo que la ventana se cierra tan pronto como se carga el DOM.

¿Facebook ha hecho algo específico para que no podamos usar la propiedad cerrada? ¿Crees que puedo hacer algo?

 <html> <head><title>Popup</title></head> <body> <input type="button" id="openPopupWorking" onclick="popup('https://www.wikipedia.org');" value="Open Popup Wikipedia" /> <input type="button" id="openPopupNotWorking" onclick="popup('https://www.facebook.com/Starbucks/');" value="Open Popup Facebook" /> <script type="text/javascript"> function popup(SiteUrl) { var myWindow=window.open(SiteUrl,'newWindow','width=900,height=900'); //Check if the popup is closed by the user ! Don t work with Facebook var timer = setInterval(function () { if (myWindow && myWindow.closed===true) { alert('Popup is closed') clearInterval(timer); } }, 1000); } </script> </body> </html>

Gracias por tu ayuda.

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!