From 0c62ce4cf024e6917181d5b8f5198146d74fcc1e Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 17 Sep 2018 22:17:40 +0200 Subject: [PATCH] web: fix websocket uri when page is loaded via file:// --- web/socket/app.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/web/socket/app.js b/web/socket/app.js index b9dade96e..29e28a5ed 100644 --- a/web/socket/app.js +++ b/web/socket/app.js @@ -309,12 +309,17 @@ function wsUrl(endpoint) var l = window.location; var url = ''; - if (l.protocol === 'https:') - url += 'wss://'; - else - url += 'ws://'; + if (l.protocol == 'file:') { + url += 'ws://localhost'; + } + else { + if (l.protocol === 'https:') + url += 'wss://'; + else + url += 'ws://'; - url += l.hostname; + url += l.hostname; + } if ((l.port) && (l.port != 80) && (l.port != 443)) url += ':'+ l.port;