Can I load a web worker script from an absolute URL?

前端 未结 3 1014
说谎
说谎 2020-12-10 20:53

I haven\'t been able to get something like this to work:

var myWorker = new Worker(\"http://example.com/js/worker.js\");

In my Firebug cons

3条回答
  •  执笔经年
    2020-12-10 21:48

    According to the Web Worker draft specification, workers must be hosted at the same domain as the "first script", that is, the script that is creating the worker. The URL of the first script is what the worker URL is resolved against.

提交回复
热议问题