From ec34af8f6133f5b5603f47b0c3f91bde60e6d9b5 Mon Sep 17 00:00:00 2001 From: jalf Date: Fri, 5 Apr 2013 13:45:27 +0200 Subject: [PATCH] Use wss when creating localhost connection to detect binary support Some browsers (Firefox) reject unencrypted ws connections if the hosting page uses https by throwing an exception when you create the websocket object. NoVNC interprets this as binary being unsupported, and falls back to base64. If we instead connect to wss://localhost, the websocket object can be created regardless of whether the hosting page is on http or https. --- include/websock.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/websock.js b/include/websock.js index 01a24c3f..b8cc46f6 100644 --- a/include/websock.js +++ b/include/websock.js @@ -282,7 +282,7 @@ function init(protocols) { // TODO: this sucks, the property should exist on the prototype // but it does not. try { - if (bt && ('binaryType' in (new WebSocket("ws://localhost:17523")))) { + if (bt && ('binaryType' in (new WebSocket("wss://localhost:17523")))) { Util.Info("Detected binaryType support in WebSockets"); wsbt = true; }