4 ms·
This is true of pretty much anything that wants to directly invoke the browser's download mechanism. AFAICT the options are either: 1. Use JS, in which case o
by jdmichal 5y ago
This is true of pretty much anything that wants to directly invoke the browser's download mechanism. AFAICT the options are either:
1. Use JS, in which case one can handle errors and otherwise be involved in the request / response process. However, if you wish to offer a "download" funciton, this necessitates downloading all the data into JS memory before offering it to the user.
2. Use form-posting with `Content-Disposition`. One can no longer be involved with the request and response. And any response which does not have `Content-Disposition` will result in the browser redirecting. However, the user will be able to directly stream the download without your page being involved beyond initiating the request.
Since the data downloads are gigabytes in our case, we opted for (2). But I would also love to hear if I'm wrong about this trade-off.