在编写与volttron进行通信的HTML时如何解决CORS问题?

时间:2019-05-28 02:14:08

标签: html cors volttron

我已经安装了'simpleweb agent',并且正在编写html文档以通过网络与volttron链接。

作为参考,我主要使用Chrome浏览器。

我在浏览器地址栏中输入了“ http://ip-address:8080/simpleweb/jsonrpc”。

我已经确认它的工作原理类似于“ {”,“ jsonrpc”:“ 2.0”,“ id”:“ id”,“ result”:“大量响应都在这里”}”

我编写了一个简单的html代码,使用http get函数显示了相应的值。

不幸的是我遇到了一个错误。

错误代码

From

我发现该HTML文件在IE中或以Chrome中的“禁用网络安全”模式运行时效果很好。

有没有办法解决这个问题?

html代码

- Access to XMLHttpRequest at 'http://ip-address:8080/simpleweb/jsonrpc' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
loadDoc @ test.html: 26
onclick @ test.html: 7
test.html: 26

- Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://ip-address:8080/simpleweb/jsonrpc'. at loadDoc at HTMLButtonElement.onclick

0 个答案:

没有答案