Skip to content

Instantly share code, notes, and snippets.

@mkuklis
Created November 21, 2013 19:28
Show Gist options
  • Save mkuklis/7587994 to your computer and use it in GitHub Desktop.
Save mkuklis/7587994 to your computer and use it in GitHub Desktop.
KitKat test for WebSocket
function hasWebSocket() {
var m = navigator.userAgent.match(/Android ([0-9]+)\.([0-9]+)/i);
if (m) {
var x = parseInt(m[1], 10);
var y = parseInt(m[2], 10);
return window.WebSocket && (x > 4 || (x == 4 && y >= 4));
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment