Window.isSecureContext

Nasi wolontariusze nie przetłumaczyli jeszcze tego artykułu na język Polski. Dołącz do nas i pomóż go przetłumaczyć!
Można także przeczytać artykuł w języku English (US).

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.

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 Working Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) 49 (49) ? ? ?
Considers window.opener No support 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)
Considers window.opener No support (Yes) 49.0 (49) ? ? ? ?

See also

Autorzy i etykiety dokumentu

 Ostatnia aktualizacja: mnoorenberghe,