Is it possible to load a web user script from an absolute URL? - The answer is missing.
However, there is a hack I found for this:
var worker; //= new Worker('http://xyz/FSWorker.js'); var xhr = new XMLHttpRequest(); xhr.open("GET", 'http://xyz/FSWorker.js'); xhr.responseType = 'blob'; xhr.onload = function(e) { var blob = this.response; worker = new Worker(window.URL.createObjectURL(blob)); fs_ready(); // do more stuff here }; xhr.send(null);
I do not like this method, so I should start using the worker only when the XHR is finished. Another option is to work with the built-in worker, but this is even more ugly, because then I will have to put all my code in one huge line.
Is there a better way to do this?
source share