HTML and CSS Reference
In-Depth Information
JavaScript provides an easy way to find out whether a browser can execute
WebSocket-specific code:
if (window.WebSocket) {
console.log("WebSockets supported.");
// Continue with the rest of the
WebSockets-specific functionality…
else {
console.log("WebSockets not supported.");
alert("Consider updating your browser for a
richer experience.");
The window.WebSocket statement indicates whether the WebSocket protocol is
implemented in the browser. The following statements are equivalent:
"WebSocket" in window
Each one of them results in the same validation check. You can also check about
any feature support using your browser's developer tools.
Want to see which browsers do support the WebSocket protocol? There is an up-to-
date resource available at .
At the time of writing, WebSocket is fully supported by Internet Explorer 10+, Firefox
Search WWH ::

Custom Search