CORB:JSFiddle 上的跨域读取阻塞
CORB: Cross-Origin Read Blocking on JSFiddle
我将 https://unpkg.com/htmx.org@1.3.3/dist/htmx.min.js.gz 添加到我的 jsfiddle,但现在我得到:
CORB: Cross-Origin Read Blocking
有办法解决这个问题吗?
JSFiddle:https://jsfiddle.net/thomas_guettler/7cLy8m5u/3/
代码:
<button
hx-get="https://raw.githubusercontent.com/guettli/html-fragments/main/fragments/simple-div.html">
Press me
</button>
如果我使用这个URL:https://unpkg.com/htmx.org@1.3.3/dist/htmx.min.js
然后我得到
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.
我找到了 work-around.
如果我使用模拟端点,那么它就可以工作。
例如:https://run.mocky.io/v3/6f4b9b4c-4ac9-44e0-89fa-da7d222346df
我猜 github 的响应中的这个 http header 让浏览器拒绝了代码段:
Referrer Policy: strict-origin-when-cross-origin
我将 https://unpkg.com/htmx.org@1.3.3/dist/htmx.min.js.gz 添加到我的 jsfiddle,但现在我得到:
CORB: Cross-Origin Read Blocking
有办法解决这个问题吗?
JSFiddle:https://jsfiddle.net/thomas_guettler/7cLy8m5u/3/
代码:
<button
hx-get="https://raw.githubusercontent.com/guettli/html-fragments/main/fragments/simple-div.html">
Press me
</button>
如果我使用这个URL:https://unpkg.com/htmx.org@1.3.3/dist/htmx.min.js
然后我得到
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.
我找到了 work-around.
如果我使用模拟端点,那么它就可以工作。
例如:https://run.mocky.io/v3/6f4b9b4c-4ac9-44e0-89fa-da7d222346df
我猜 github 的响应中的这个 http header 让浏览器拒绝了代码段:
Referrer Policy: strict-origin-when-cross-origin