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?