Cross-Browser Testing for WebSockets

The traditional way to test for websockets is this: [sourcecode] function WebSocketTest() { if (“WebSocket” in window) { alert(“Browser supports websocket”); } else { alert(“Browser does not support websocket”); } } … Run WebSocket test [/sourcecode] Although the above example will be technically correct for modern browsers it is important to consider some of the “experimental” implementation of this feature in earlier FireFox (Mozilla) browsers. In FireFox (Mozilla), experimental features (until they graduate) gets added with a prefix of “Moz”.