mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Don't check against the window to detect node.js, wrap code in a try catch statement
and have it degrade gracefully. Fixes #147
This commit is contained in:
@@ -202,10 +202,10 @@ exports.ua.ios6 = exports.ua.ios && /OS 6_/.test(navigator.userAgent);
|
||||
*/
|
||||
|
||||
exports.request = function request (xdomain) {
|
||||
if ('undefined' == typeof window) {
|
||||
try {
|
||||
var _XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
|
||||
return new _XMLHttpRequest();
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
if (xdomain && 'undefined' != typeof XDomainRequest && !exports.ua.hasCORS) {
|
||||
return new XDomainRequest();
|
||||
|
||||
Reference in New Issue
Block a user