Merge pull request #196 from 3rd-Eden/master

Load swf based on the connection options
This commit is contained in:
Guillermo Rauch
2011-06-20 02:42:27 -07:00
2 changed files with 16 additions and 9 deletions

View File

@@ -120,11 +120,12 @@
};
var url = [
'http' + (options.secure ? 's' : '' ) + '://' + options.host + ':' + options.port
, this.options.resource
, io.protocol
, '?t=' + + new Date
].join('/');
'http' + (options.secure ? 's' : '') + ':/'
, options.host + ':' + options.port
, this.options.resource
, io.protocol
, '?t=' + + new Date
].join('/');
if (this.isXDomain()) {
var insertAt = document.getElementsByTagName('script')[0]

View File

@@ -86,16 +86,22 @@
|| !('__initialize' in WebSocket) || !swfobject
) return false;
var supported = swfobject.getFlashPlayerVersion().major >= 10;
var supported = swfobject.getFlashPlayerVersion().major >= 10
, options = socket.options
, path = [
'http' + (options.secure ? 's' : '') + ':/'
, options.host + ':' + options.port
, options.resource
, 'static/flashsocket'
, 'WebSocketMain' + (socket.isXDomain() ? 'Insecure' : '') + '.swf'
];
// Only start downloading the swf file when the checked that this browser
// actually supports it
if (supported){
if (typeof WEB_SOCKET_SWF_LOCATION === 'undefined'){
// Set the correct file based on the XDomain settings
var path = '/socket.io/static/flashsocket/WebSocketMain';
path = path + (socket.isXDomain() ? 'Insecure' : '') + '.swf';
WEB_SOCKET_SWF_LOCATION = path;
WEB_SOCKET_SWF_LOCATION = path.join('/');
}
WebSocket.__initialize();