From 51734e4f1e0083bd907774bc6e3ae30f222b74b7 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Tue, 10 Nov 2015 13:33:06 -0500 Subject: [PATCH] Use XDR when making cross-origin api requests Fixes GH-224. IE < 10 needs to use "cross domain requests" for cross-origin XHR requests. These don't support custom headers which doesn't affect us at the moment, but might become annoying later. --- src/mixins/api.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mixins/api.jsx b/src/mixins/api.jsx index 6ffeca5a4..31de9c2f0 100644 --- a/src/mixins/api.jsx +++ b/src/mixins/api.jsx @@ -26,6 +26,12 @@ var Api = { opts.uri = opts.host + opts.uri; var apiRequest = function (opts) { + if (opts.host !== '') { + // For IE < 10, we must use XDR for cross-domain requests. XDR does not support + // custom headers. + defaults(opts, {useXDR: true}); + opts.headers = {}; + } xhr(opts, function (err, res, body) { if (err) log.error(err); callback(err, body);