summaryrefslogtreecommitdiff
path: root/source/bower_components/modernizr/feature-detects/websockets-binary.js
blob: 8f549ce066be5695e59ab2583bcc606535414ec6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

// binaryType is truthy if there is support.. returns "blob" in new-ish chrome.
// plus.google.com/115535723976198353696/posts/ERN6zYozENV
// github.com/Modernizr/Modernizr/issues/370

Modernizr.addTest('websocketsbinary', function() {
  var protocol = 'https:'==location.protocol?'wss':'ws',
  protoBin;

  if('WebSocket' in window) {
    if( protoBin = 'binaryType' in WebSocket.prototype ) {
      return protoBin;
    }
    try {
      return !!(new WebSocket(protocol+'://.').binaryType);
    } catch (e){}
  }

  return false;
});