首页 > 解决方案 > 套接字 IO:加载资源失败:net::ERR_BLOCKED_BY_CLIENT

问题描述

我正在使用Arduino Create Agent制作一个与 Arduino Uno 交互的 Web 界面。我不得不为此使用SocketIO。代理 wiki 页面上的教程要求我编写这行 JavaScript,它产生了 2 个如下错误:

Access to XMLHttpRequest at 'http://127.0.0.1:8992/socket.io/?EIO=3&transport=polling&t=1621252158361-0' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

socket.io.min.js:1 GET http://127.0.0.1:8992/socket.io/?EIO=3&transport=polling&t=1621252158274-0 net::ERR_BLOCKED_BY_CLIENT

我追踪了这个问题,发现错误来自一个XmlHttpRequest. 通过使用Localtunnel转发我的端口,我能够摆脱第一个错误,但第二个错误仍然存​​在。有什么办法可以解决这个问题吗?

提前致谢!

标签: javascriptsocket.ioarduinoxmlhttprequest

解决方案



推荐阅读