From f848f34b9979740e85b9648eb42ecafd20dd3926 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Wed, 22 Nov 2023 18:48:59 +0100 Subject: Add clause for checking ws in https --- webAO/client.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webAO/client.ts b/webAO/client.ts index 820b7f2..c49a104 100644 --- a/webAO/client.ts +++ b/webAO/client.ts @@ -83,6 +83,13 @@ fpPromise } } + if (window.location.protocol === "https:" && connectionString.startsWith("ws://")) { + // If protocol is https: and connectionString is ws:// + // We have a problem, since it's impossible to connect to ws:// from https:// + // Connection will fail, but at least warn the user + alert('Attempted to connect using insecure websockets on https page. Please try removing s from https:// in the URL bar.') + } + client = new Client(connectionString); client.connect() isLowMemory(); -- cgit