0

I'm trying to download a file using HTML a tag

 var a = document.createElement("a");
 a.href = "floor.laz";
 a.click();

I get this error:

enter image description here

After the browser started the download. Is there anyway to know from the code when an error like this happens?

Normal
  • 528
  • 4
  • 19
  • In Chrome by pressing F12 you can get to DevTools and errors are listed in Console tab – IiroP May 09 '17 at 15:00
  • have a reporter on the server. Which checks if the whole file is downloaded. The trigger for checking can be sent when the user clicks on the link. – warcops May 09 '17 at 15:01
  • Why use a link when you can use ajax and catch every error possible? – Bast May 09 '17 at 15:02
  • I would think you can use the HTTP server response code. And like @Bast advices is to use Ajax. http://stackoverflow.com/questions/22987349/is-there-a-way-to-get-http-status-code-name-using-js-and-angularjs – Daniel May 09 '17 at 15:06

0 Answers0