Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

125
Visualizações
Execute web code files in the browser through JavaScript

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".

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda