From 8f255b4a4957b14dda6245513fa23868213ab4e2 Mon Sep 17 00:00:00 2001 From: Alexander Hotz Date: Sun, 27 Sep 2015 15:49:03 +0200 Subject: [PATCH] switch to wss when loading page over https --- docroot/last/websock.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docroot/last/websock.js b/docroot/last/websock.js index c749b36..172d878 100644 --- a/docroot/last/websock.js +++ b/docroot/last/websock.js @@ -58,7 +58,7 @@ window.onload = function() { // var url = 'ws://' + location.host + '/ws/last'; // console.log(JSON.stringify(location)); - var url = "ws://" + location.host + "/"; + var url = ("https:" == document.location.protocol ? "wss://" : "ws://") + location.host + "/"; var parts = location.pathname.split('/'); for (var i = 1; i < parts.length - 2; i++) { url = url + parts[i] + "/";