mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
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.
This commit is contained in:
parent
ae8c25e2c4
commit
51734e4f1e
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue