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

202
Views
Popup window loses reference on page reload

I'm opening a popup window with javascript and, when it loads, I have bind some events to the loaded content.

But, if user clicks a link, submit a form or do something else (inside the popup) that changes popup location, I would need to rebind those events. Tried to do like this:

const _popup = window.open(
    '...',
    null,
    "scrollbars=no; width=1024px; height=768px"
);
_popup.onload = function(){
    //bind events...
    //do stuff...
};

Instead of rerun the _popup.onload function, it loses reference and I can't rebind them.

Also tried: _popup.addEventListener('load', function(){ /*...*/ });. But the result is the same.

How would I attach an event to the popup window that will run even if it's location changes?

about 4 years ago · Santiago Gelvez
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!