This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The window.isSecureContext read-only property indicates whether a context is capable of using features that require secure contexts.


var isSecure = window.isSecureContext


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 () {


Specification Status Comment
Secure Contexts Candidate Recommendation Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
isSecureContextChrome Full support 47Edge Full support 15Firefox Full support 49IE No support NoOpera Full support 34Safari Full support 11.1WebView Android Full support 47Chrome Android Full support 47Firefox Android Full support 49Opera Android Full support 34Safari iOS Full support 11.3Samsung Internet Android Full support 5.0
Considers window.opener
Chrome No support NoEdge No support NoFirefox Full support 49IE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android No support NoFirefox Android Full support 49Opera Android ? Safari iOS ? Samsung Internet Android No support No


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