jpillora / xdomain

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

Problem with prototype.js 1.6.x in Internet Explorer 8/9 #142

Closed tombebombe closed 9 years ago

tombebombe commented 9 years ago

Hello,

we ran into what looks like an incompatibility between prototype.js in versions 1.6.x and xdomain on IE8/IE9:

Please don't ask why we have to use such an old library.... If looking into it doesn't seem to be worth it, i fully understand.

Console output: LOG: xdomain ($master$): adding slave: $slave$ LOG: xdomain ($master$): proxying request to slave: '$slave$' LOG: xdomain ($master$): creating iframe xdomain-f8b472f9 LOG: xdomain ($master$): new socket: xdomain-fb2e403d LOG: xdomain ($slave$): adding master: $master$ LOG: xdomain ($slave$): new socket: xdomain-fb2e403d LOG: xdomain ($slave$): slave listening for requests on socket: xdomain-fb2e403d LOG: xdomain ($slave$): receive socket: xdomain-fb2e403d: 'XD_CHECK': '[object Object]' LOG: xdomain ($slave$): send socket: xdomain-fb2e403d: ready LOG: xdomain ($slave$): ready socket: xdomain-fb2e403d (emit #0 pending) LOG: xdomain ($master$): receive socket: xdomain-fb2e403d: 'ready' LOG: xdomain ($master$): send socket: xdomain-fb2e403d: request LOG: xdomain ($master$): receive socket: xdomain-fb2e403d: 'XD_CHECK': '[object Object]' LOG: xdomain ($master$): send socket: xdomain-fb2e403d: ready LOG: xdomain ($master$): ready socket: xdomain-fb2e403d (emit #1 pending) LOG: xdomain ($slave$): receive socket: xdomain-fb2e403d: 'XD_CHECK': '[object Object]'

After that, it just stops.

Our theory is that prototype 1.6.x somewhat alters XMLHttpRequest in a way that interferes with xdomain on IE8/IE9.

Thanks!

jpillora commented 9 years ago

It is quite a niche use-case, maybe before I look into it, could you try it out one of the XHook examples http://jpillora.com/xhook and report back? It's most likely an XHook issue, otherwise it could be a postMessage issue

tombebombe commented 9 years ago

Thanks for the quick reply.

I am not overly familiar with xhook (i just know what it does and that xdomain uses it), so i just took your vanilla example and added a reference to prototype: http://uharc.net/~tombe/work/xhook_vanilla_prototype_1.6.html

It seems to work fine in any browser. Are there other modifications i can try in order to find out whether it is an xhook issue?

when i do the same with your xdomain example (http://jpillora.com/xdomain/), i get the same problems with IE8 and IE9. Prototype 1.6.x does not work on cross domain requests, prototype 1.7.x does: http://uharc.net/~tombe/work/xdomain_prototype_1.6.html http://uharc.net/~tombe/work/xdomain_prototype_1.7.html

In all cases, it does not seem to matter whether prototype.js was loaded before or after xhook.js/xdomain.js.

Thanks again.

Edit: I guess you probably don't have native IE8 and/or IE9 at hand (i sadly have to...). Fortunately, the problem also shows in IE10 and IE11 if you set the document mode to IE8 or IE9.

tombebombe commented 9 years ago

Update: The CMS we have to work with in this case has been updated to prototype 1.7, which fixes our issue.

Thank you for your help!

jpillora commented 9 years ago

Glad you got this sorted, sorry I couldn't help more