我想获取这个网址的数据https://github.com/ProjectSakura/OTA/blob/10/changelog/changelog_beryllium.txt#L2
我正在尝试使用 fetch api 来获取数据,但我收到了 cors 错误
这是我想要做的
async function showmodal1() {
console.log("hello")
const data = await
fetch('https://github.com/ProjectSakura/OTA/blob/10/changelog/changelog_beryllium.txt');
console.log(data)
}
showmodal1();
Run Code Online (Sandbox Code Playgroud)
有什么方法可以获取 github txt 文件的数据我尝试通过互联网找到它,但我找不到任何东西提前谢谢您的帮助
编辑:
Access to fetch at 'https://github.com/ProjectSakura/OTA/blob/10/changelog/changelog_beryllium.txt' 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. changelog.html:361
GET https://github.com/ProjectSakura/OTA/blob/10/changelog/changelog_beryllium.txt net::ERR_FAILED
showmodal1 @ changelog.html:361
(anonymous) @ changelog.html:365 …Run Code Online (Sandbox Code Playgroud)