开发者

What is the alternative to WebSocket for Firefox (and IE)

开发者 https://www.devze.com 2023-03-08 06:30 出处:网络
When looking for WebSocket on Firefox (or IE) ... if (\"WebSocket\" in window) { ... } 开发者_开发问答else

When looking for WebSocket on Firefox (or IE) ...

if ("WebSocket" in window)
{
    ...
}
开发者_开发问答else
{
    alert('Your browser does not support websocket');
}

They are both failing !

If they dont have any WebSocket, is there a way in JS to exchange some TCP message with a server ? (connect/send/recv ???)


Check out Socket.IO and Faye for portable implementations.


You can also use the web-socket-js which uses Flash to add WebSockets support. In fact, Socket.IO uses web-socket-js as a fallback if the browser doesn't natively support WebSockets. Socket.IO is very nice but if you just want lower level WebSockets support without requiring your backend to be written in Javascript then there are many WebSockets servers that exist.

0

精彩评论

暂无评论...
验证码 换一张
取 消