【发布时间】:2018-11-21 18:22:19
【问题描述】:
我尝试获取旧网站的网址,但发生错误:
Fetch API cannot load http://xyz.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://abc' is therefore not allowed access.
If an opaque response serves your needs, set the request's mode to 'no-cors'
to fetch the resource with CORS disabled.
我的代码是这样的
render(){
return (
<div>
<iframe src="http://localhost:8080/.../StockExchangeWidget.html" />
</div>
)
}
当我在 iFrame 之外加载它时,一切正常,但是当我尝试用 iFrame 很好地加载它时,我得到了很多错误,但仅适用于图表数据,因为您可以看到框架和按钮已加载。
当我尝试通过 url 内部的 url 加载 HTML 页面时,我也遇到了 WebSocket 错误 WebSocket 连接到“wss://widgetdata.tradingview.com/socket.io/websocket?from=widgetembed%2F&date=2018_06_09-17_59”失败:WebSocket 握手期间出错:意外响应代码:403
【问题讨论】:
标签: html reactjs sockets websocket