Skip to content

Commit 34426e7

Browse files
committed
Loader.useXDomainRequest boolean automatically set to true if the browser is specifically detected as IE9, but you can still override this. IE10 will use xhr.
1 parent 9de1d49 commit 34426e7

9 files changed

Lines changed: 44 additions & 32 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Version 2.1.0 - "Cairhien" - -in development-
7676
* Arcade Physics Body.skipQuadTree is a new boolean that if set to `true` when you collide the Sprite against a Group it will tell Phaser to skip using a QuadTree for that collision. This is handy if this Body is especially large.
7777
* Arcade Physics World.skipQuadTree will disable the use of all QuadTrees in collision methods, which can help performance in tightly packed scenes.
7878
* Cordova 'deviceready' event check added (thanks @videlais #1120)
79-
* Loader.useXDomainRequest boolean added. If `true` (the default is `false`) it will use XDomainRequest when loading JSON files instead of xhr. In rare IE edge-cases this may be required. You'll know if you need it (#1131 #1116)
79+
* Loader.useXDomainRequest boolean added. If `true` (the default is `false`, unless the browser is detected as being IE9 specifically) it will use XDomainRequest when loading JSON files instead of xhr. In rare IE edge-cases this may be required. You'll know if you need it (#1131 #1116)
8080
* Added support for Tiled objects type field (thanks @rex64 #1111)
8181
* Tile properties are now copied from the Tiled JSON data to the Phaser.Tile objects when parsed (thanks @beeglebug #1126)
8282
* All Images now have a frameData value, even if it's only one frame. This removes lots of engine code needed to check if images are sprite sheets or not, and simplifies game code too (thanks @lucbloom #1059)

build/custom/phaser-arcade-physics.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://phaser.io
99
*
10-
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 04:50:34
10+
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 05:23:08
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -11176,7 +11176,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
1117611176
*
1117711177
* Phaser - http://phaser.io
1117811178
*
11179-
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 04:50:34
11179+
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 05:23:08
1118011180
*
1118111181
* By Richard Davey http://www.photonstorm.com @photonstorm
1118211182
*
@@ -47609,10 +47609,9 @@ Phaser.Loader = function (game) {
4760947609
this.onPackComplete = new Phaser.Signal();
4761047610

4761147611
/**
47612-
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr. You'll know if you need this or not.
47613-
* @default
47612+
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr when loading json files. It is enabled automatically if the browser is IE9, but you can disable it as required.
4761447613
*/
47615-
this.useXDomainRequest = false;
47614+
this.useXDomainRequest = (this.game.device.ieVersion === 9);
4761647615

4761747616
/**
4761847617
* @property {array} _packList - Contains all the assets packs.
@@ -48737,7 +48736,7 @@ Phaser.Loader.prototype = {
4873748736
{
4873848737
this._ajax = new window.XDomainRequest();
4873948738

48740-
// XDomainRequest has a few querks. Occasionally it will abort requests
48739+
// XDomainRequest has a few quirks. Occasionally it will abort requests
4874148740
// A way to avoid this is to make sure ALL callbacks are set even if not used
4874248741
// More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9
4874348742
this._ajax.timeout = 3000;
@@ -48758,7 +48757,11 @@ Phaser.Loader.prototype = {
4875848757

4875948758
this._ajax.open('GET', this.baseURL + file.url, true);
4876048759

48761-
this._ajax.send();
48760+
// Note: The xdr.send() call is wrapped in a timeout to prevent an issue with the interface where some requests are lost
48761+
// if multiple XDomainRequests are being sent at the same time.
48762+
setTimeout(function () {
48763+
this._ajax.send();
48764+
}, 0);
4876248765
}
4876348766
else
4876448767
{

build/custom/phaser-arcade-physics.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/custom/phaser-no-libs.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://phaser.io
99
*
10-
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 04:50:34
10+
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 05:23:08
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -36440,10 +36440,9 @@ Phaser.Loader = function (game) {
3644036440
this.onPackComplete = new Phaser.Signal();
3644136441

3644236442
/**
36443-
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr. You'll know if you need this or not.
36444-
* @default
36443+
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr when loading json files. It is enabled automatically if the browser is IE9, but you can disable it as required.
3644536444
*/
36446-
this.useXDomainRequest = false;
36445+
this.useXDomainRequest = (this.game.device.ieVersion === 9);
3644736446

3644836447
/**
3644936448
* @property {array} _packList - Contains all the assets packs.
@@ -37568,7 +37567,7 @@ Phaser.Loader.prototype = {
3756837567
{
3756937568
this._ajax = new window.XDomainRequest();
3757037569

37571-
// XDomainRequest has a few querks. Occasionally it will abort requests
37570+
// XDomainRequest has a few quirks. Occasionally it will abort requests
3757237571
// A way to avoid this is to make sure ALL callbacks are set even if not used
3757337572
// More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9
3757437573
this._ajax.timeout = 3000;
@@ -37589,7 +37588,11 @@ Phaser.Loader.prototype = {
3758937588

3759037589
this._ajax.open('GET', this.baseURL + file.url, true);
3759137590

37592-
this._ajax.send();
37591+
// Note: The xdr.send() call is wrapped in a timeout to prevent an issue with the interface where some requests are lost
37592+
// if multiple XDomainRequests are being sent at the same time.
37593+
setTimeout(function () {
37594+
this._ajax.send();
37595+
}, 0);
3759337596
}
3759437597
else
3759537598
{

build/custom/phaser-no-libs.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/phaser.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://phaser.io
99
*
10-
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 04:50:34
10+
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 05:23:08
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -11176,7 +11176,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
1117611176
*
1117711177
* Phaser - http://phaser.io
1117811178
*
11179-
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 04:50:34
11179+
* v2.1.0 "Cairhien" - Built: Thu Aug 28 2014 05:23:08
1118011180
*
1118111181
* By Richard Davey http://www.photonstorm.com @photonstorm
1118211182
*
@@ -47609,10 +47609,9 @@ Phaser.Loader = function (game) {
4760947609
this.onPackComplete = new Phaser.Signal();
4761047610

4761147611
/**
47612-
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr. You'll know if you need this or not.
47613-
* @default
47612+
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr when loading json files. It is enabled automatically if the browser is IE9, but you can disable it as required.
4761447613
*/
47615-
this.useXDomainRequest = false;
47614+
this.useXDomainRequest = (this.game.device.ieVersion === 9);
4761647615

4761747616
/**
4761847617
* @property {array} _packList - Contains all the assets packs.
@@ -48737,7 +48736,7 @@ Phaser.Loader.prototype = {
4873748736
{
4873848737
this._ajax = new window.XDomainRequest();
4873948738

48740-
// XDomainRequest has a few querks. Occasionally it will abort requests
48739+
// XDomainRequest has a few quirks. Occasionally it will abort requests
4874148740
// A way to avoid this is to make sure ALL callbacks are set even if not used
4874248741
// More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9
4874348742
this._ajax.timeout = 3000;
@@ -48758,7 +48757,11 @@ Phaser.Loader.prototype = {
4875848757

4875948758
this._ajax.open('GET', this.baseURL + file.url, true);
4876048759

48761-
this._ajax.send();
48760+
// Note: The xdr.send() call is wrapped in a timeout to prevent an issue with the interface where some requests are lost
48761+
// if multiple XDomainRequests are being sent at the same time.
48762+
setTimeout(function () {
48763+
this._ajax.send();
48764+
}, 0);
4876248765
}
4876348766
else
4876448767
{

build/phaser.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/phaser.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/loader/Loader.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,9 @@ Phaser.Loader = function (game) {
100100
this.onPackComplete = new Phaser.Signal();
101101

102102
/**
103-
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr. You'll know if you need this or not.
104-
* @default
103+
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr when loading json files. It is enabled automatically if the browser is IE9, but you can disable it as required.
105104
*/
106-
this.useXDomainRequest = false;
105+
this.useXDomainRequest = (this.game.device.ieVersion === 9);
107106

108107
/**
109108
* @property {array} _packList - Contains all the assets packs.
@@ -1228,7 +1227,7 @@ Phaser.Loader.prototype = {
12281227
{
12291228
this._ajax = new window.XDomainRequest();
12301229

1231-
// XDomainRequest has a few querks. Occasionally it will abort requests
1230+
// XDomainRequest has a few quirks. Occasionally it will abort requests
12321231
// A way to avoid this is to make sure ALL callbacks are set even if not used
12331232
// More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9
12341233
this._ajax.timeout = 3000;
@@ -1249,7 +1248,11 @@ Phaser.Loader.prototype = {
12491248

12501249
this._ajax.open('GET', this.baseURL + file.url, true);
12511250

1252-
this._ajax.send();
1251+
// Note: The xdr.send() call is wrapped in a timeout to prevent an issue with the interface where some requests are lost
1252+
// if multiple XDomainRequests are being sent at the same time.
1253+
setTimeout(function () {
1254+
this._ajax.send();
1255+
}, 0);
12531256
}
12541257
else
12551258
{

0 commit comments

Comments
 (0)