I created the Query File Download plugin
) which fixes the problem and provides some other nice features. It basically gives you a "full Ajax-like" experience for file downloads (complete with callbacks even) that isn't normally possible for file downloads. It also has some other handy features:
- User never leaves the same page they initiated a file download from whether it is successful or there is an error
- successCallback and failCallback functions allow for you to be explicit about what the UI behavior is in either situation
- In conjunction with jQuery UI a developer can easily show a modal telling the user that a file download is occurring, disband the modal after the download starts or even inform the user in a friendly manner that an error has occurred. See the Demo
for more example.