News for hackers. Stuff that matters.
Re:Show HN: BrowserBox – do stuff with browsers that you can... by thih9 on Saturday April 08, 2023 @11:45AM (#35494414)
> CORS difficulties end up encouraging developers to push files to the server at least temporarily instead

I get that you need the user to explicitly select the file but I don’t understand the need to upload to a server.

Couldn’t you ask the user to select the file and just use the file locally, e.g. with the File API? https://developer.mozilla.org/en-US/docs/Web/API/File

I guess things break when you need repeated access and when having to pick the same file multiple times would be bad UX.

Re:Show HN: BrowserBox – do stuff with browsers that you can... by Lalabadie on Saturday April 08, 2023 @10:21PM (#35499539)
That's the better solution, yes.

In the case I was referring, we loaded files as blobs in the browser's local storage, allowing us to run a web worker as a persistent local cache server.

This involved managing Firefox's admirable response doctoring policies, though.

All other browsers would let a web worker modify the incoming response to a request before forwarding it to an iframe, but FF absolutely refused it and required that the modified response get constructed anew in its local context, meaning locally created or injected content could not be mistakenly trusted as origin content.

Re:Show HN: BrowserBox – do stuff with browsers that you can... by thih9 on Sunday April 09, 2023 @06:35AM (#35501429)
Thanks for the details!