jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 269 forks source link

IE9 responds with data undefined #169

Open kazuo opened 8 years ago

kazuo commented 8 years ago

Hello, I'm using xdomain 0.7.3 and unable to get it working on IE9. I'm using the simple settings of defining master and slave inline with the script. I tested it against Chrome (with xdomain.debug = true) to ensure xdomain is being used and configured correctly.

What's happening in IE9 is after doing a GET request, accessing the response data via Javascript comes back undefined. The GET request does respond back with a 200 with a response body of the expected data. It doesn't seem like it's passing the data.

I looked at the security settings in IE9 seeing if it has something to do with iFrames. I changed two settings under Tools > Internet Options > Security > Custom Level... > Miscellaneous:

Please let me know if any more information is required for clarity. Thanks!

Edit: I went back a few versions to see if there are any working versions for my app. I found that 0.6.17 has the data from the response instead of undefined. I haven't had a chance to fully test 0.6.17, but at the very minimum, 0.6.17 has the expected data and starting at 0.7.0 it has undefined data.

jpillora commented 8 years ago

Hi Rey, can you run through the FAQ in the README and report back?

On Wed, Sep 16, 2015 at 8:16 AM Rey Marin Jr. notifications@github.com wrote:

Hello, I'm using xdomain 0.7.3 and unable to get it working on IE9. I'm using the simple settings of defining master and slave inline with the script. I tested it against Chrome (with xdomain.debug = true) to ensure xdomain is being used and configured correctly.

What's happening in IE9 is after doing a GET request, accessing the response data via Javascript comes back undefined. The GET request does respond back with a 200 with a response body of the expected data. It doesn't seem like it's passing the data.

I looked at the security settings in IE9 seeing if it has something to do with iFrames. I changed two settings under Tools > Internet Options > Security > Custom Level... > Miscellaneous:

  • "Access data sources across domains" switched to Enable
  • "Navigate windows and frames across different domains" to Enable

Please let me know if any more information is required for clarity. Thanks!

— Reply to this email directly or view it on GitHub https://github.com/jpillora/xdomain/issues/169.

jyasthin commented 8 years ago

@jpillora

The same situation has occurred. (I use ajax library jQuery v2.2.3)

Here's the debug output:

xdomain (http://localhost:49704): proxying request to slave: 'http://~' xdomain (http://localhost:49704): creating iframe xdomain-3b97f78b xdomain (http://localhost:49704): new socket: xdomain-2627a7bb xdomain (http://localhost:49704): receive socket: xdomain-2627a7bb: ready xdomain (http://localhost:49704): send socket: xdomain-2627a7bb: request xdomain (http://localhost:49704): receive socket: xdomain-2627a7bb: XD_CHECK -> [object Object] xdomain (http://localhost:49704): send socket: xdomain-2627a7bb: ready xdomain (http://localhost:49704): ready socket: xdomain-2627a7bb (emit #1 pending) xdomain (http://localhost:49704): receive socket: xdomain-2627a7bb: xhr-event -> readystatechange xdomain (http://localhost:49704): receive socket: xdomain-2627a7bb: xhr-event -> readystatechange xdomain (http://localhost:49704): receive socket: xdomain-2627a7bb: response xdomain (http://localhost:49704): send socket: xdomain-2627a7bb: close xdomain (http://localhost:49704): close socket: xdomain-2627a7bb

It seems IE8/9 are different from the others in xhr event's occurence.

SzymonPawlak commented 7 years ago

@jpillora

the same situation with angular2 but in all browsers

xdomain (master domain): adding slave: slave domain
xdomain.js:1022xdomain (master domain): proxying request to slave: 'slave domain'
xdomain.js:1022xdomain (master domain): creating iframe xdomain-3caaac88
xdomain.js:1022xdomain (master domain): new socket: xdomain-7002f295
lang.js:130Angular is running in the development mode. Call enableProdMode() to enable the production mode.
xdomain.js:1022 xdomain (master domain): receive socket: xdomain-7002f295: ready
xdomain.js:1022 xdomain (master domain): send socket: xdomain-7002f295: request
xdomain.js:1022 xdomain (master domain): receive socket: xdomain-7002f295: XD_CHECK
xdomain.js:1022 xdomain (master domain): send socket: xdomain-7002f295: ready
xdomain.js:1022 xdomain (master domain): ready socket: xdomain-7002f295 (emit #1 pending)
3xdomain.js:1022 xdomain (master domain): receive socket: xdomain-7002f295: xhr-event -> readystatechange
xdomain.js:1022 xdomain (master domain): receive socket: xdomain-7002f295: xhr-event -> progress
xdomain.js:1022 xdomain (master domain): receive socket: xdomain-7002f295: xhr-event -> readystatechange
xdomain.js:1022 xdomain (master domain): receive socket: xdomain-7002f295: xhr-event -> progress
xdomain.js:1022 xdomain (master domain): receive socket: xdomain-7002f295: response
xdomain.js:1022 xdomain (master domain): send socket: xdomain-7002f295: close
xdomain.js:1022 xdomain (master domain): close socket: xdomain-7002f295

_body in response is null although in the network -> response have the correct data