I have a website at example.com and I serve all external resources from cdn.example.com . So, on my HTML page in example.com , I have something like:
<script type="text/javascript" src="http://cdn.example.com/script.js"></script>
In my script, I want to create a web worker, so I:
worker = new Worker("http://cdn.example.com/script.js");
But this fails in Firefox 16 with the error Failed to load script: http://cdn.example.com/script.js (nsresult = 0x805303f4) . It works on Safari 6 and Chrome 22.
The problem seems to be that the origin is different . The effective start of the script is example.com and cdn.example.com does not match this. This seems like a mistake because CORS doesn't help without setting document.domain (or at least I couldn't get it to work while playing with it). Is there any way to make it work?
Mitar source share