我能否以编程方式检测是否发生了 CORB 错误?

Can I programmatically detect whether a CORB error occurred?

我正在寻找一种方法来以编程方式检测(使用 JavaScript)我页面上的资源加载(我可以完全控制)是否被 Cross-Origin Resource Blocking.

例如,由于 https://example.com 的响应具有 Content-Type text/html; charset=UTF-8,以下 HTML 代码将在基于 Chromium 的浏览器中触发 CORB 错误:

<script src="https://example.com"></script>

但是我怎样才能检测到它发生了呢?简单地为脚本元素上的 error 事件添加处理程序是行不通的;例如,以下代码不会打开对话框:

<script src="https://example.com" onerror="alert('CORB!')"></script>

请注意,我修复 CORB 错误或检查 CORB错误的内容;我只对以编程方式检测是否发生 CORB 错误感兴趣。这可能吗?

我很高兴被证明是错误的,但是,根据我目前所读的内容,以编程方式检测是否发生了 CORB 错误是不可能的,至少在一般情况下是不可能的。

但是,在某些情况下,您可能会泄露一些跨源信息:

Cross-Origin Read Blocking (CORB) is a web platform security feature aimed at reducing the impact of speculative side-channel attacks such as Spectre. Unfortunately, blocking certain types of requests introduced a new type of XS-Leaks that allows attackers to detect if CORB was enforced on one request, but wasn’t on another.

(来源:https://xsleaks.dev/docs/attacks/browser-features/corb/