[英]CORB: Cross-Origin Read Blocking on JSFiddle
I added https://unpkg.com/htmx.org@1.3.3/dist/htmx.min.js.gz to my jsfiddle, but now I get:我将https://unpkg.com/htmx.org@1.3.3/dist/htmx.min.js.gz添加到我的 jsfiddle 中,但现在我得到了:
CORB: Cross-Origin Read Blocking
CORB:跨域读取阻塞
Is there a way to work around this?有没有办法解决这个问题?
JSFiddle: https://jsfiddle.net/thomas_guettler/7cLy8m5u/3/ JSFiddle: https://jsfiddle.net/thomas_guettler/7cLy8m5u/3/
Code:代码:
<button
hx-get="https://raw.githubusercontent.com/guettli/html-fragments/main/fragments/simple-div.html">
Press me
</button>
If I use this URL: https://unpkg.com/htmx.org@1.3.3/dist/htmx.min.js如果我使用这个 URL: https://unpkg.com/htmx.org@1.3.3/dist/htmx.min.js
then I get然后我得到
Access to XMLHttpRequest at 'https://raw.githubusercontent.com/guettli/html-fragments/main/fragments/simple-div.html' from origin 'https://fiddle.jshell.net' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
CORS 策略已阻止从源“https://fiddle.jshell.net”访问“https://raw.githubusercontent.com/guettli/html-fragments/main/fragments/simple-div.html”上的 XMLHttpRequest :对预检请求的响应未通过访问控制检查:它没有 HTTP ok 状态。
I found a work-around.我找到了解决方法。
If I use a mocky endpoint, then it works.如果我使用模拟端点,那么它可以工作。
For example: https://run.mocky.io/v3/6f4b9b4c-4ac9-44e0-89fa-da7d222346df例如: https://run.mocky.io/v3/6f4b9b4c-4ac9-44e0-89fa-da7d222346df
I guess this http header in the response of github makes the browser reject the snippet:我猜这个 http header 在 github 的响应中使浏览器拒绝该片段:
Referrer Policy: strict-origin-when-cross-origin
推荐人政策:strict-origin-when-cross-origin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.