My single page web app have buttons to download file which needs to properly recover from errors. For that I have this code:
// to download a file we don\'t w