I want to dynamically load a user's local folder into an iframe.
For example the end user is a developer and they have code
app-folder index.html style.css script.js
I want the user to be able to drag the app-folder
onto the iframe and load the source.
I can get index.html
to load by getting the HTML 5 file object and running,
iframe.src = window.URL.createObjectURL(file)
.
However, index.html
references <script src="script.js"></script>
and it no longer knows how to resolve script.js
.
I tried looping through the source as a string and replacing tags with the object url. But I'm hesitant to continue with that route because I think it would prove to unreliable, as more complicated projects may get out of hand.
Any thoughts or examples would be much appreciated!