问题描述
脚本调用 GM_xmlhttpRequest 访问 localhost资源 出现 CORS限制
GM_xmlhttpRequest({
url: 'http://localhost:xxx/xxx`,
method: 'GET',
onload: (res) => {
console.log("res: ", res);
},
onerror: (e) => {
console.error(e);
}
});`
重现步骤
刚从tampermokey迁移过来的脚本,tm上运行正常的。
- 脚本有添加
//connect localhost
- 脚本设置>授权管理 选项下添加了 cors
脚本猫版本
1.3.2
操作系统以及浏览器信息
Windows10 , Chrome 148.0.7778.179(正式版本) (64 位)
补充信息 (选填)
Access to XMLHttpRequest at 'http://localhost:xx/...' from origin 'chrome-extension://xxx' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
localhost:xxx/xxx:1 Failed to load resource: net::ERR_FAILED
问题描述
脚本调用 GM_xmlhttpRequest 访问 localhost资源 出现 CORS限制
重现步骤
刚从tampermokey迁移过来的脚本,tm上运行正常的。
//connect localhost脚本猫版本
1.3.2
操作系统以及浏览器信息
Windows10 , Chrome 148.0.7778.179(正式版本) (64 位)
补充信息 (选填)
Access to XMLHttpRequest at 'http://localhost:xx/...' from origin 'chrome-extension://xxx' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
localhost:xxx/xxx:1 Failed to load resource: net::ERR_FAILED