What are the simple and feasible ie9 ie8 WebSocket support solutions?

so far I have found three solutions, none of which will work.

do you have any other simple solutions?

  • can be introduced to let IE9 support WebSocket
  • or simply configure it, while does not need to change any server-side scheme
< table > < thead > < tr > < th > serial number < / th > < th > Scheme < / th > < th > document < / th > < th > implementation technology < / th > < / tr > < / thead > < tbody > < tr > < td > 1 < / td > < td > jwebsocket < / td > < td > ide/jwebsocket-web-client" rel=" nofollow noreferrer "> http://www.jwebsocket.org/doc. < td > based on flash < / td > < / tr > < tr > < td > 2 < / td > < td > web-socket-js < / td > < td > https://github.com/gimite/web. < td > based on flash < / td > < / tr > < tr > < td > 3 < / td > < td > sockjs-client < / td > < td > https://github.com/sockjs/soc. < td > based on iframe on ie9 < / td > < / tr > < / tbody > < / table >

Thank you!


after testing, web-socket-js is almost compatible to the end. Because web-socket-js is based on flash, it must be required that IE8, IE9 be Flash Player 10 or later.

web-socket-js is a flash-based technology that allows browsers to use almost native WebSocket interfaces by introducing two js files and a swf file. In addition, web-socket-js still needs to do a service of flash security policy file on port 843 of ws server.

I have done WebSocket compatibility to IE5 weird mode based on stompjs and web-socket-js, myself. Of course, stompjs has compatibility problems on the lower version of IE, and stompjs is no longer maintained. You can use a version of my fork at https://github.com/wangduandu.

.

mainly older versions of IE have some anomalies in regular expression behavior.


      // fix ie8, ie9, RegExp not normal problem
      // in chrome the frames length will be 2, but in ie8, ie9, it well be 1
      // by wdd 20180321
      if (frames.length === 1) {
        frames.push('')
      }
< H1 > example of web-socket-js usage < / H1 >
  • Port 843 of the websocket server also needs to deploy a flash security policy file service
  • copy swfobject.js, web_socket.js, WebSocketMain.swf to the response directory
  • write the following code
<!-- Import JavaScript Libraries. -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="web_socket.js"></script>

<script type="text/javascript">
  
  // Let the library know where WebSocketMain.swf is:
  WEB_SOCKET_SWF_LOCATION = "WebSocketMain.swf";
  
  // Write your code in the same way as for native WebSocket:
  var ws = new WebSocket("ws://example.com:10081/");
  ws.onopen = function() {
    ws.send("Hello");  // Sends a message.
  };
  ws.onmessage = function(e) {
    // Receives a message.
    alert(e.data);
  };
  ws.onclose = function() {
    alert("closed");
  };
  
</script>

if your WebSocket is always disconnected, please refer to https://wdd.js.org/websocket-.

.

all three solutions have passed the test. The web-socket-js I tested is not supported in IE8 mode, so it's crazy to find problems. No solution was found on github.


does sockjs support IE9?


Port 843 of the websocket server also needs to deploy a flash security policy file service;
how to deploy this? Running: make sure the server is running and flash socket policy file is currectly placed


many lower versions of browsers do not support websocket very well, so it is necessary to do downward compatibility. Generally, it is troublesome to mix websocket+polling to do this. In formal projects, you can consider the use of third-party push frameworks such as GoEasy, which are compatible, and also support wss, heartbeat and reconnection mechanisms. Address: https://www.goeasy.io/

.
Menu