i'm trying programmatically click <a>
element has download attribute , href download file server. if there error downloading, server return html page error status code. because of html5 download attribute tries force download html page or downloads server error file. there way can have open html error file in new tab instead of downloading? setting target attribute _blank.
you can request file using xmlhttprequest
or fetch
, if no error occurs, set <a>
element href
, download
attributes, else redirect user document displaying error response.
Comments
Post a Comment