Skip to content
This repository has been archived by the owner on Jan 13, 2020. It is now read-only.

Fix HTTPS problem #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion htdocs/openwebrx.js
Original file line number Diff line number Diff line change
Expand Up @@ -1634,10 +1634,15 @@ String.prototype.startswith=function(str){ return this.indexOf(str) == 0; }; //h

function open_websocket()
{
var protocol = 'ws';
if(window.location.toString().indexOf('https://') == 0){
protocol = 'wss';
}

//if(ws_url.startswith("ws://localhost:")&&window.location.hostname!="127.0.0.1"&&window.location.hostname!="localhost")
//{
//divlog("Server administrator should set <em>server_hostname</em> correctly, because it is left as <em>\"localhost\"</em>. Now guessing hostname from page URL.",1);
ws_url="ws://"+(window.location.origin.split("://")[1])+"/ws/"; //guess automatically -> now default behaviour
ws_url = protocol + "://"+(window.location.origin.split("://")[1])+"/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.");
Expand Down