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.
精彩评论