Skip to content
This repository has been archived by the owner on Jun 23, 2018. It is now read-only.

Workers in iframe not working #82

Open
runemadsen opened this issue May 12, 2014 · 3 comments
Open

Workers in iframe not working #82

runemadsen opened this issue May 12, 2014 · 3 comments

Comments

@runemadsen
Copy link

I'm trying to load the jsrepl from a CDN, and I keep getting worker security errors. As stated in the documentation, I tried to load the workers in an iframe to bypass this:

jsrepl.loadLanguage('python', function () {  
    alert('Python loaded');  
  }, false);

But this doesn't seem to change anything at all. Is it possible to load jsrepl from a CDN, or is this functionality broken at the moment?

Thanks for a great lib!

@amasad
Copy link
Contributor

amasad commented May 12, 2014

Yeah unfortunately worker scripts need to be loaded from the same domain as the parent script (Cross-origin policy). There are CDNs that work on the same domain, like fastly. Maybe try that.

@runemadsen
Copy link
Author

Thanks for this! As a quick follow-up question, how hard would it be to patch JSRepl to work on a remote CDN? Would it be possible to do something in iframe/script injection to make it possible to live on an external CDN, while the workers are still considered local?

@amasad
Copy link
Contributor

amasad commented Aug 17, 2014

Not sure to be honest. If you want to load the main script and the language files from different domains you need to use CORS. I think it'll be hard because you need to make emscripten use CORS for file loading

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants