jpillora / xdomain

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

IE9/8 - cross-domain call from AJAX response not triggering #158

Closed arunmenon1975 closed 9 years ago

arunmenon1975 commented 9 years ago

A link on my page (say, the homepage) makes an AJAX request and pulls in a form. The user enters data and submits the form to a PHP file. This PHP file returns data (echos) in the form of a <script> chunk that has a soap object required by jquery.soap with all the required params filled in. The URL to send the soap data(very similar to how the jquery $.ajax URL is defined) is a cross-domain request.

On IE10+, Chrome, Firefox and Safari and the stock Android browser Xdomain kicks in when it encounters the cross-domain URL in the AJAX response <script> and proceeds as desired. Everything works perfectly.

On IE9/8 the $.soap URL isn't intercepted. The jquery.soap script gets everything correct right till the beforeSend. The next step would be to call the cross-domain URL, which simply just doesn't work in these 2 browser versions. I have logging turned on, and usually(in the browsers where it works) the xdomain logs would show the initiation of the cross-domain request and subsequent logs.

I must be missing something obvious since IE9/8 are supported versions. There is a possibility that it could be an issue with the jquery.soap script, so i have opened an issue there as well.

jpillora commented 9 years ago

Hey @arunmenon1975 run through these https://github.com/jpillora/xdomain#faq--troubleshooting and report back (sorry, report back here, accidently posted on the soap repo)

arunmenon1975 commented 9 years ago

I re-read the FAQs, went through a few issues listed, and made some changes. From early testing it now seems that the issue is fixed.

A roundup of the changes:

// second attempt to get some progres info (but still a no go)
// I still keep this in tho, we might see it working one day when browsers mature...
                xhr: function() {
                    var xhr = new window.XMLHttpRequest();
......
......

Thanks for this fantastic script. It works out of the box and handles everything thrown at it. In my case, i had a few other things going in tandem requiring stringent observation under the hood.

Closing this issue for now. I have also closed the issue opened at the jquery.soap repository.

Please note: may re-open if issue persists while i test a little more intensively.