在 JavaScript 中获取 API #403

问题描述 投票:0回答:1

我想修复下面的错误,所以我使用了 proxyUrl,我解决了,但又出现了另一个错误。

Access to fetch at 'https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=json' (redirected from 'http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=json') 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. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

这是代码:js code

这是错误:error

如何修复错误?

javascript fetch-api
1个回答
0
投票

您似乎无法再使用该服务:https://github.com/Rob--W/cors-anywhere/issues/301您必须自己托管代理服务器。

© www.soinside.com 2019 - 2024. All rights reserved.