Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.

Commit aeae73c

Browse files
author
David Chelimsky
committed
correctly handle case in which MozWebSocket is not defined
1 parent 73de90e commit aeae73c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

jquery.websocket.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@
1111
(function($){
1212
$.extend({
1313
websocket: function(url, s) {
14-
if (typeof(WebSocket) == "undefined") {
15-
WebSocket = MozWebSocket || null;
16-
}
17-
var ws = WebSocket ? new WebSocket( url ) : {
18-
send: function(m){ return false; },
19-
close: function(){}
20-
};
14+
var ws = window['MozWebSocket'] ? new MozWebSocket(url) : window['WebSocket'] ? new WebSocket(url) : {
15+
send: function(m){ return false; },
16+
close: function(){}
17+
};
2118
var settings = {
2219
open: function(){},
2320
close: function(){},

0 commit comments

Comments
 (0)