Skip to content

Commit 9c74110

Browse files
authored
Add Modernizr warning when running in non-secure context (element-hq#28581)
Signed-off-by: Michael Telatynski <[email protected]>
1 parent bfac727 commit 9c74110

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/vector/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ function checkBrowserFeatures(): boolean {
6767
// although this would start to make (more) assumptions about how rust-crypto loads its wasm.
6868
window.Modernizr.addTest("wasm", () => typeof WebAssembly === "object" && typeof WebAssembly.Module === "function");
6969

70+
// Check that the session is in a secure context otherwise most Crypto & WebRTC APIs will be unavailable
71+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext
72+
window.Modernizr.addTest("securecontext", () => window.isSecureContext);
73+
7074
const featureList = Object.keys(window.Modernizr) as Array<keyof ModernizrStatic>;
7175

7276
let featureComplete = true;

0 commit comments

Comments
 (0)