javascript - 套接字 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转发我的端口,我能够摆脱第一个错误,但第二个错误仍然存在。有什么办法可以解决这个问题吗?
提前致谢!
解决方案
推荐阅读
- python - 根据其他列的值前向填充
- javascript - 如何将页面滚动链接到 div 元素滚动?或者如何使用页面滚动来滚动 div 元素?
- c# - 如何使用 dotnet core 解密 Pgp 加密的文件
- dart - 是否可以在 Icons 或 FontAwesomeIcons 等中选择随机图标
- ios - 从 Ubuntu/Windows 到 Mac Mini 调试 Flutter 应用程序的选项
- python - 如何在 Python 中计算组内日期时间之间的差异?
- asp.net-core - .NET Core 1.1 成功登录后的身份错误 - 用户授权失败:(null)
- python - 从 __init__.py 中的函数导入模块将模块对象绑定到全局命名空间?
- haskell - Haskell 中的 MQTT 服务器
- python - 根据条件在基于 Django 类的视图中获取不同的表单