mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Lazy loading of Flash removed temporarily due to a bug in Safari 4
This commit is contained in:
@@ -1,29 +1,7 @@
|
||||
io.Transport.flashsocket = io.Transport.websocket.extend({
|
||||
|
||||
_ready: false,
|
||||
|
||||
init: function(base){
|
||||
this.__super__(base);
|
||||
|
||||
if (!('WebSocket' in window)){
|
||||
if (!('swfobject' in window)) io.lab.script(io.path + 'lib/vendor/web-socket-js/swfobject.js').wait();
|
||||
if (!('FABridge' in window)) io.lab.script(io.path + 'lib/vendor/web-socket-js/FABridge.js').wait();
|
||||
|
||||
var self = this;
|
||||
io.lab.script(io.path + 'lib/vendor/web-socket-js/web_socket.js').wait(function(){
|
||||
WebSocket.__swfLocation = io.path + 'lib/vendor/web-socket-js/WebSocketMain.swf';
|
||||
self._ready = true;
|
||||
if (self._doConnect) self.connect();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
connect: function(){
|
||||
if (!this._ready){
|
||||
this._doConnect = true;
|
||||
return this;
|
||||
}
|
||||
return this.__super__();
|
||||
this.__super__(base);
|
||||
},
|
||||
|
||||
_onClose: function(){
|
||||
@@ -41,12 +19,12 @@ io.Transport.flashsocket = io.Transport.websocket.extend({
|
||||
|
||||
io.Transport.flashsocket.check = function(){
|
||||
if ('navigator' in window && navigator.plugins){
|
||||
return !! navigator.plugins['Shockwave Flash'].description;
|
||||
return !! navigator.plugins['Shockwave Flash'].description && ('__initialize' in WebSocket);
|
||||
}
|
||||
|
||||
if ('ActiveXObject' in window){
|
||||
try {
|
||||
return !! new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
|
||||
return !! new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version') && ('__initialize' in WebSocket);
|
||||
} catch (e){}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,5 +36,5 @@ io.Transport.websocket = io.Transport.extend({
|
||||
});
|
||||
|
||||
io.Transport.websocket.check = function(){
|
||||
return 'WebSocket' in window;
|
||||
return 'WebSocket' in window && !('__initialize' in WebSocket);
|
||||
};
|
||||
Reference in New Issue
Block a user