Skip to content

Commit

Permalink
Merge pull request #148 from 3rd-Eden/better-node-xhr
Browse files Browse the repository at this point in the history
Don't check against the window to detect node.js, wrap code in a try cat...
  • Loading branch information
rauchg committed Mar 27, 2013
2 parents 6878014 + 3c6eb2a commit b5c982c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b5c982c

Please sign in to comment.