0

How to listen to the window.open event. I have a function in which I export to excel as

window.open('URL','_self');

It is working fine but what I need to achieve is while exporting of data I need to show one loader and after compilation of window.open ,I need to remove that loader. But I am unable to catch that window.open callback event.

Can anyone please help me on this.

I tried addEventListener,load and onload of window events nothing worked.

function windowClose() {
    window.location.reload();
    alert("fdg");
}
var  popup= window.open('URL'_self' );  
popup.onload = windowClose;
A. A. Sebastian
  • 540
  • 1
  • 7
  • 19
dvv
  • 138
  • 2
  • 11

1 Answers1

0

Accessing a data from other window is not a good practice.

So answer to your question is You cannot and you should not.

Well technically you cannot access data if it is from another host but to me you should not do that for same domain too, because some browsers may don't allow this with same domain. And this will depend on the security configuration of your server too.

Akshay
  • 3,558
  • 4
  • 43
  • 77