fix urls for when we aren't running on the root

This commit is contained in:
root
2019-11-25 20:17:11 +01:00
parent 147c108570
commit b774e75f2c
5 changed files with 15 additions and 11 deletions

View File

@ -1532,7 +1532,9 @@ function open_websocket() {
protocol = 'wss';
}
var ws_url = protocol + "://" + (window.location.origin.split("://")[1]) + "/ws/"; //guess automatically -> now default behaviour
var base = protocol + "://" + (window.location.href.split("://")[1]);
if (!base.endsWith('/')) base += '/';
var ws_url = base + "ws/"; //guess automatically -> now default behaviour
if (!("WebSocket" in window))
divlog("Your browser does not support WebSocket, which is required for WebRX to run. Please upgrade to a HTML5 compatible browser.");
ws = new WebSocket(ws_url);