New home page for developer.chrome.com
[chromium-blink-merge.git] / net / data / websocket / websocket_shared_worker.html
blob7acb4ab37415f6398e7e552d96623fb78952f87a
1 <html>
2 <body>
3 <div id=result></div>
4 <script>
5 function log(message)
7 document.getElementById("result").innerHTML += message + "<br>";
9 var worker = new SharedWorker("websocket_worker_simple.js");
10 var href = window.location.href;
11 var hostBegin = href.indexOf("/") + 2;
12 var hostEnd = href.lastIndexOf(":");
13 var host = href.slice(hostBegin, hostEnd);
14 var portBegin = hostEnd + 1;
15 var portEnd = href.lastIndexOf("/");
16 var port = href.slice(portBegin, portEnd);
17 var url = "ws://" + host + ":" + port + "/echo-with-no-extension";
18 worker.port.onmessage = function (evt) {
19 log(evt.data);
20 if (evt.data == "DONE") {
21 document.title = "OK";
22 } else {
23 document.title = "FAIL";
26 worker.port.postMessage(url);
28 </script>
29 </body>
30 </html>