I have created a sort-of web IDE allowing the creation and editing of files, etc., that currently works offline without the need of a server to store files.
What I need, is a way to open those files in the browser through JavaScript at the press of the button. Kind of like the stackoverflow code editor, but the website should be opened in a new tab. The method for doing this should have as minimal impact on the user of the IDE as possible. For example, I couldn't just convert all files to blob URLs because that would limit the user for doing things like referencing main.js in their index.html for example.
I was researching the File and Directory Entries API, but browser support is not good. This would've allowed me to store all files locally and access them via URLs prepended with filesystem:.
For example, a solution could be to automatically create blob URLs for all files, look through the user's code and replace all references to those files with their blob counterparts, but it would get exponentially harder to replace references if the user decides to reference anything dynamically with JavaScript.
My backup plan is just to create a server to download all the files from the client and serve them back to the client, but the fact that a server shouldn't even be needed (in theory) makes this idea of creating a server seem unnecessary.
Does anyone know of any APIs similar to the File and Directory Entries API that may be useful? Or any other methods for achieving what I've described?
Edit: The answer to this question mentions service workers being able to "send custom responses to HTTP requests".