This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The window.isSecureContext
read-only property indicates whether a context is capable of using features that require secure contexts.
var isSecure = window.isSecureContext
You can use feature detection to check whether they are in a secure context or not by using the isSecureContext
boolean which is exposed on the global scope.
if (window.isSecureContext) { // Page is a secure context so service workers are now available navigator.serviceWorker.register("/offline-worker.js").then(function () { ... }); }
Specification | Status | Comment |
---|---|---|
Secure Contexts | Working Draft | Initial definition. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | (Yes) | 49 (49) | ? | ? | ? |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | No support | (Yes) | 49.0 (49) | ? | ? | ? | (Yes) |
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/window/isSecureContext