jquery.fileDownload icon indicating copy to clipboard operation
jquery.fileDownload copied to clipboard

IE11 Success or Failure callbacks never called when an empty file downloaded

Open gvazq82 opened this issue 10 years ago • 1 comments

Hi John,

I am having a particular issue with IE10 +, probably it is happening in previous versions but have not tested.

The problem I am having is none of the callbacks are been called after an empty file is returned from the server leaving an infinite download in progress.

This issue is partially caused because an not proper exception handling in the server side, returning the following headers:

Content-Type: application/json
Content-disposition header is not present as in this case it was a failure on my server that is not been handle properly.

I am able to solve the infinite download verifying the state of the document, but not sure if this could be a way to avoid infinite downloads from the client:

if ($contents.length && $contents[0] === $form[0] && formDoc.readyState == 'loading') {
  isFailure = false;
}

Please let me know your comments, any information that you can provide is highly appreciated.

Gabriel.

gvazq82 avatar Apr 10 '15 18:04 gvazq82

The readyState is a good way to check and for file downloads and I almost went with that approach except not all browsers properly transition from 'loading' while the file download is occurring to 'complete' when it is done. The cookie approach seemed the most foolproof but yeah if your headers are weird it probably prevents cookies from working. In your case you should probably roll your own i'd think but beware of chrome especially when using the readyState approach.

johnculviner avatar Apr 11 '15 19:04 johnculviner