First note that in order to do this without being blocked because of cross-domain restrictions (or without having to parameterize CORS headers on your server), you must :
- serve both your main page and the popup content (your excel file) from the same domain, and the same port
- open your main page in
http://
and not in file://
If those conditions are respected, the best solution is to use jquery as its load function waits "until all assets such as images have been completely received" :
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<script>
var popup = window.open('popup.html');
$(popup.document).load(function() {
alert('loaded');
// do other things
});
</script>
</body>
</html>
Be careful with your global scheme : each browser/configuration may do something different when you think they "open" the file. There's no way to detect with a simple open
if they decided to dismiss it, hadn't the proper plugin, simply downloaded it.