WindowOrWorkerGlobalScope.crossOriginIsolated

翻译不完整。 请帮助我们翻译这篇文章!

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

crossOriginIsolated 是 WindowOrWorkerGlobalScope 的一个只读属性,返回一个布尔值,该值指示是否可以通过Window.postMessage()调用发送 SharedArrayBuffer

该值取决于响应中存在的Cross-Origin-Opener-PolicyCross-Origin-Embedder-Policy 头。

语法

var myCrossOriginIsolated = self.crossOriginIsolated; // 或直接 crossOriginIsolated

类型

布尔类型

示例

if(crossOriginIsolated) {
  // post SharedArrayBuffer
} else {
  // Do something else
}

规范

Specification Status Comment
HTML Living Standard Not yet merged into the spec

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
crossOriginIsolated
ExperimentalNon-standard
Chrome No support NoEdge No support NoFirefox Full support 72IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.

参见