Support Content-Disposition attachment response downloads for server/remote files. #19
Labels
blazor server
This is related to blazor server side
blazor wasm
This is related to blazor client side
enhancement
New feature or request
Problem
When downloading a file from a server directly to JavaScript or Blazor the browser has it's own memory and hardware limitations.
Solution
We should use
Content-Disposition
attachment response header as it has more cross-browser compatibility.When using Content-Disposition attachment response header the backing store that the browser uses its the local disk.
This way we will bypass the limitations of the Max File Size of JavaScript and Blazor.
Brainstorming
To make this work with seamless integration we would need to create a JavaScript function which:
window
form
inside the newwindow
withaction
="specified url"method
="specified method"enctype
="specified encode type"inputs
if an object is provided as argumentform
in thatwindow
to the specified urlNot sure if I am missing something else but this should trigger the file download process within the browser provider and no data should be loaded into memory to JavaScript or Blazor and go straight to the device local disk instead.
Why not an iframe and a window instead?
Iframe will only work on sites that are on the same domain or sites with Access-Control-Allow-Origin response header
If neither of them are considered or present we will hit for sure the same-origin policy error.
Authorization Header
Authorization tokens may be passed down to the new
window
andform
as aninput
value to be submitted with the rest of the other inputs values.AFAIK there is no way to pass down authorization token in a header when submitting a form or sending cross domain cookies.
Sample references
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open3
https://gist.github.com/carlosrivera/768b0c14e083c1ab423f
The text was updated successfully, but these errors were encountered: