Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!