- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我正在尝试使用 importScripts
从 web worker 导入 json 数据,出现以下错误。
Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at (my:URL to fetch data from server) failed to load.
网络 worker 代码在这里。我能够从我的网络工作线程和主 js 线程发送基本消息。我想从我的服务器从网络工作线程获取 jsonp 数据,然后回复主 js 线程。
/*web worker js file to fetch json data from server and then return to main javascript thread*/
self.onmessage = function(e)
{
var curr = setInterval(function()
{
var message = e.data;
fetchMyTournament(message);
}, 10000);
}
function fetchMyTournament(userid)
{
self.postMessage('worker saying hi');
var url = "(server URL mapping)?callback=processInfo&type=(typeOfArgument)&userId="+userid;
importScripts(url);
self.postMessage("After import script");
}
function processInfo(objJSON)
{
self.postMessage("Data returned from the server...: "
+ JSON.stringify(objJSON));
}
最佳答案
就我而言,我是这样导入 PouchDB 的:importScripts("//cdn.jsdelivr.net/pouchdb/5.3.1/pouchdb.min.js");
网址应以正确的 http/https 开头。所以改成这个解决了问题:importScripts("https://cdn.jsdelivr.net/pouchdb/5.3.1/pouchdb.min.js");
关于javascript - 未捕获的网络错误 : Failed to execute 'importScripts' on 'WorkerGlobalScope' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24349175/
我尝试从网络 worker 内部的服务器获取数据。但在开发工具中每次我都会遇到同样的错误。 Uncaught (in promise) TypeError: Failed to execute 'fe
我正在尝试在我的 pwa nuxtjs 应用程序中启用 OneSignal 通知。 modules: [ '@nuxtjs/axios', '@nuxtjs/onesignal',
只是想知道为什么 window.top 在 WorkerGlobalScope 中返回“undefined”。 我在 MDN 网站上读到,但它没有说明任何关于这种情况的信息。 最佳答案 Just wa
我正在尝试使用 importScripts 从 web worker 导入 json 数据,出现以下错误。 Uncaught NetworkError: Failed to execute 'impo
我在尝试学习 React Native 时不断遇到这个错误。该应用程序将运行良好,然后我进行了一些添加,但它中断并显示此错误: 生成它的代码是: import React from 'react';
我在尝试学习 React Native 时不断遇到这个错误。该应用程序将运行良好,然后我进行了一些添加,但它中断并显示此错误: 生成它的代码是: import React from 'react';
我正在尝试获取 this信用卡读卡器来处理我的 Angular 应用程序。我按照自述中的所有步骤操作并获得了许可证 key ,但由于某种原因,我收到以下错误 Error during the init
我是一名优秀的程序员,十分优秀!