max-mapper / requirebin

write browser JavaScript programs using modules from NPM
requirebin.com
391 stars 80 forks source link

<script> & <link> tags are ignored (possible solution included) #116

Open tsneed290 opened 8 years ago

tsneed290 commented 8 years ago

Working with this gist: http://requirebin.com/?gist=01274d1e3cd82fa3d12cdb6466f42106

First off, this is an awesome tool! Thank you for giving me such a great head start on my own project.

I was fooling around locally with the project, specifically the <head> area of the app and attempted to place a <link> and a <script> tag in it. I was expecting the <link> tag (pointing to a Google Font) to work, and expecting the <script> tag to fail since there is no "some-library.js" on requirebin's servers.

Instead, I saw no attempt to download those assets from within Chrome (51) DevTool's Network tab. It was like the tags were being ignored completely.

After some searching, I found that I was able to get it to work by adjusting iframe's source code (project is depended on from requirebin and browser-module-sandbox), changing:

tempIframe.src = targetUrl to tempIframe.srcdoc = opts.html

It seems that Chrome didn't like the created Blob URL. Using srcdoc instead seemed to work. I doubt this is a very clever solution, and welcome any comments to this issue.

Mind you, I intend to fork this project to suit my own needs, so I'm not sure if this is even an appropriate issue to report. But I figured I'd raise it in case anyone else experienced similar issues.

Thanks! Tim