У меня есть веб-работник, см. Ниже.
var worker_script = function(){
self.onmessage = function(e){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
postMessage(xhttp.responseText);
counter = 0;
}
};
xhttp.open("GET",e.data, true);
xhttp.send();
}
}
var search_worker = new Worker(URL.createObjectURL(new Blob(["("+worker_script.toString()+")()"], {type: 'text/javascript'})));
// post message to worker
search_worker.postMessage("https://www.connectnigeria.com/ajax/getkeywords?keyword=");
search_worker.onmessage = function(e){
console.log(e);
};
это работает на моем локальном сервере, но на моем рабочем сервере выдает эту ошибку
Uncaught DOMException: не удалось выполнить «open» для «XMLHttpRequest»:
Неверный URL на self.onmessage
(Блоб: https://mywebsitesample.com/d17ebd88-7452-4282-9313-26d697fea457:1:198)
в чем может быть проблема? есть идеи?