Is there a Microsoft equivalent for HTML5 Server-Sent Events?

前端 未结 2 1034
面向向阳花
面向向阳花 2020-12-23 00:09

I am using HTML5 Server-Sent Events as follows:

    SSEUpdate = new EventSource(\"http://example.com/update.php\");
    SSEUpdate.onmessage = function(e){
           


        
相关标签:
2条回答
  • 2020-12-23 00:22

    In a word, no.

    Microsoft has not included SSE or an equivalent of SSE in any version of IE. IMO, you have two good options:

    1. Use a polyfill - My tests with this polyfill in IE10 and IE11 were all successful. Since it starts with if ("EventSource" in global) return;, it'll only run in browsers that do not support EventSource.
    2. Use websockets instead - Although it requires more server-side setup (The ws:// protocol), it works in IE10 and 11 and provides more options such as bi-directional communication.
    0 讨论(0)
  • 2020-12-23 00:29

    SSE native support for IE is not there. You can achieve same thing using polyfill

    0 讨论(0)
提交回复
热议问题