title: Can't connect to the websocket server
body: <p>I am new comer for websocket on frontend. This question might be stupid :) 
  The following html file is to try out websocket. The connection can be successfully established if this page is rendered from the backend web service. But if openning this file from the disk with browser, the connection can't be established. </p>
  
  <pre><code>&lt;!-- websockets.html --&gt;
  &lt;input id="input" type="text" /&gt;
  &lt;button onclick="send()"&gt;Send&lt;/button&gt;
  &lt;pre id="output"&gt;&lt;/pre&gt;
  &lt;script&gt;
      var input = document.getElementById("input");
      var output = document.getElementById("output");
      var socket = new WebSocket("ws://localhost:8081/echo");
  
      socket.onopen = function () {
          output.innerHTML += "Status: Connected\n";
      };
  
      socket.onmessage = function (e) {
          output.innerHTML += "Server: " + e.data + "\n";
      };
  
      function send() {
          socket.send(input.value);
          input.value = "";
      }
  &lt;/script&gt;
  </code></pre>