--- title: WindowOrWorkerGlobalScope.crossOriginIsolated slug: Web/API/WindowOrWorkerGlobalScope/crossOriginIsolated translation_of: Web/API/WindowOrWorkerGlobalScope/crossOriginIsolated ---
crossOriginIsolated
是 {{domxref("WindowOrWorkerGlobalScope")}} 的一个只读属性,返回一个布尔值,该值指示是否可以通过{{domxref("Window.postMessage()")}}调用发送 {{jsxref("SharedArrayBuffer")}}。
该值取决于响应中存在的{{httpheader("Cross-Origin-Opener-Policy")}} 和{{httpheader("Cross-Origin-Embedder-Policy")}} 头。
var myCrossOriginIsolated = self.crossOriginIsolated; // 或直接 crossOriginIsolated
布尔类型
if(crossOriginIsolated) { // post SharedArrayBuffer } else { // Do something else }
Specification | Status | Comment |
---|---|---|
{{SpecName("HTML WHATWG")}} | Not yet merged into the spec |
{{Compat("api.WindowOrWorkerGlobalScope.crossOriginIsolated")}}