--- title: WindowOrWorkerGlobalScope.isSecureContext slug: Web/API/isSecureContext tags: - API - Property - Reference - Window - WindowOrWorkerGlobalContext - Workers - isSecureContext translation_of: Web/API/WindowOrWorkerGlobalScope/isSecureContext original_slug: Web/API/WindowOrWorkerGlobalScope/isSecureContext ---
{{APIRef()}}{{SeeCompatTable}}
isSecureContext
是 {{domxref("WindowOrWorkerGlobalScope")}} 的一个只读属性,返回一个布尔值,标识当前上下文是否安全,安全(true)或不安全(false)。
var isItSecure = self.isSecureContext; // 或者直接使用 isSecureContext
{{domxref("Boolean")}}.
Specification | Status | Comment |
---|---|---|
{{SpecName('Secure Contexts', 'webappapis.html#dom-origin', 'WindowOrWorkerGlobalScope.isSecureContext')}} | {{Spec2('Secure Contexts')}} | Initial definition. |
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatChrome(55)}} | {{CompatGeckoDesktop(52)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{CompatChrome(55)}} | {{CompatChrome(55)}} | {{CompatGeckoMobile(52)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |