Index: net/data/websocket/connect_check.html |
diff --git a/net/data/websocket/connect_check.html b/net/data/websocket/connect_check.html |
index 4a1ca8c5dfc0b7cb86b86f019a3a4038db867f35..567d80c829b47dad009ed8afbb7e9a37ca24a854 100644 |
--- a/net/data/websocket/connect_check.html |
+++ b/net/data/websocket/connect_check.html |
@@ -3,17 +3,8 @@ |
<head> |
<title>test ws connection</title> |
<script type="text/javascript"> |
- |
-var href = window.location.href; |
-var hostBegin = href.indexOf('/') + 2; |
-var hostEnd = href.lastIndexOf(':'); |
-var host = href.slice(hostBegin, hostEnd); |
-var portBegin = hostEnd + 1; |
-var portEnd = href.lastIndexOf('/'); |
-var port = href.slice(portBegin, portEnd); |
-var scheme = href.indexOf('https') >= 0 ? 'wss' : 'ws'; |
-var url = scheme + '://' + host + ':' + port + '/echo-with-no-extension'; |
- |
+var scheme = location.protocol.replace('http', 'ws'); |
Adam Rice
2014/07/14 12:12:14
Clever! But I think the URL will end up like ws:12
yhirano
2014/07/15 01:50:03
Oops, sorry. Fixed.
|
+var url = scheme + location.host + '/echo-with-no-extension'; |
// Do connection test. |
var ws = new WebSocket(url); |