Web/API/Window/isSecureContext

From Get docs

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

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
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 window.opener

Experimental'

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