I have a URL I know will usually open a file that the UA will download (with a content-disposition: attachment
header), but sometimes will just result in a 500
or other error page.
Currently I am triggering the download by setting document.location
in JavaScript.
I don’t want to open a new tab or page for this, but I also don’t want to have my users end up at a 500 page for no good reason on occasion.
Is there method to this that would address my concerns?
For example, creating an invisible <iframe>
with the download URL as its source? I don’t want to invent something new, but rather am curious if anyone knows of a tried-and-true solution.