简体   繁体   中英

window.open callback event

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;

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM