The window.isSecureContext
read-only property indicates whether a context is capable of using features that require secure contexts.
Syntax
var isSecure = window.isSecureContext
Examples
Feature detection
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 () {
...
});
}
Specifications
Specification | Status | Comment |
Secure Contexts | Candidate Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
isSecureContext
|
Chrome
Full support 47 |
Edge
Full support 15 |
Firefox
Full support 49 |
IE
No support No |
Opera
Full support 34 |
Safari
Full support 11.1 |
WebView Android
Full support 47 |
Chrome Android
Full support 47 |
Firefox Android
Full support 49 |
Opera Android
Full support 34 |
Safari iOS
Full support 11.3 |
Samsung Internet Android
Full support 5.0 |
Considers |
Chrome
No support No |
Edge
No support No |
Firefox
Full support 49 |
IE
No support No |
Opera
? |
Safari
? |
WebView Android
Full support Yes |
Chrome Android
No support No |
Firefox Android
Full support 49 |
Opera Android
? |
Safari iOS
? |
Samsung Internet Android
No support No |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
See also
Window.isSecureContext by Mozilla Contributors is licensed under CC-BY-SA 2.5.