0

I'm updating an old system. When a user clicked on a button to download a file, javascript would disable the button and display a "please wait" div.

They also added in the window.onfocus a function that would enable the button and hide the div.

This was working well under IE8, they just upgraded to IE11 and the behavior for downloading file has changed and the window.onfocus is not always called (after a save as).

After downloading a file, how can I hide a "please wait" div? Which event in IE11 replaced the window.onfocus event from IE8 ?

rene
  • 41,474
  • 78
  • 114
  • 152
the_lotus
  • 12,668
  • 3
  • 36
  • 53
  • Try to Window.focus() after file download. – Domain Nov 13 '14 at 14:13
  • @WisdmLabs That's what I'm trying to figure out. How to know in javascript when a file got downloaded. – the_lotus Nov 13 '14 at 14:15
  • @j08691 they use window.onfocus to know if a file got downloaded. This doesn't work well in IE11. I'm looking for a way to detect when a file was downloaded in javascript. – the_lotus Nov 13 '14 at 14:17
  • May be [this](http://www.mkyong.com/javascript/focus-is-not-working-in-ie-solution/) is useful. – Domain Nov 13 '14 at 14:19
  • @WisdmLabs I don't understand how the link can help. It doesn't explain how to detect when a file has finished downloading. I cannot force the "please wait" div to hide after x amount of second as the file could take a long or short time to download. – the_lotus Nov 13 '14 at 14:23
  • Sorry that didn't help you, but if you go through [this](http://stackoverflow.com/questions/1106377/detect-when-browser-receives-file-download) SO question, you will get really helpful content. Hope it helps. – Domain Nov 13 '14 at 14:34
  • 1
    @j08691 - no. **Read the question**. The old method is no longer workable. **Therefore the old code is irrelevant to the question**. – Chris Stratton Nov 13 '14 at 16:51
  • 1
    @WisdmLabs Thanks! This is the kind of alternative I was looking for, I wasn't searching for the right keywords. – the_lotus Nov 13 '14 at 17:01

0 Answers0