forked from mirror/MCSManager
自适应HTTPS
This commit is contained in:
parent
81b0f8c0e0
commit
1a3d75a015
@ -10,6 +10,19 @@ MCSERVER.WS_PROTOCOL = "ws://";
|
||||
//HTTP 默认协议
|
||||
MCSERVER.HTTP_PROTOCOL = "http://";
|
||||
|
||||
//自适应HTTPS
|
||||
var protocolStr = document.location.protocol;
|
||||
if(protocolStr == "http:")
|
||||
{
|
||||
MCSERVER.WS_PROTOCOL = 'ws://';
|
||||
MCSERVER.HTTP_PROTOCOL = 'http://';
|
||||
}
|
||||
else if(protocolStr == "https:")
|
||||
{
|
||||
MCSERVER.WS_PROTOCOL = 'wss://';
|
||||
MCSERVER.HTTP_PROTOCOL = 'https://';
|
||||
}
|
||||
|
||||
//URL定位器
|
||||
MCSERVER.URL = function (url, protocol) {
|
||||
var _protocol = protocol || MCSERVER.HTTP_PROTOCOL;
|
||||
|
Loading…
Reference in New Issue
Block a user