victorquinn/Backbone.CrossDomain

jQuery.support.cors = true

aroc opened this issue · 2 comments

aroc commented

Hey there,

First of all, your a live saver. Thanks so much for writing this. Our team has to support IE8+ and cross domain requests has been a crappy issue to deal with.

This library seems to work perfectly so far, however I needed to set jQuery.support.cors = true to get it to work properly.

Not sure if this is the case for many other people, but it might be worth looking into adding it right beside useXDomainRequest = true;

Hey aroc,

Thanks for the kind words.

The intent there was to defer to jQuery.support.cors to figure out whether a particular browser would support cors. This should be true for most modern browsers and false for IE7/8/9 (and any other browser that doesn't support cors of course).

It's not intended to be set, only read, it's a result of jQuery's internal test to see whether a given browser supports cors. See: http://vq.io/12fvcQj

$.support.cors contains the result of a test that tests whether or not the current browser supports cors. changing it doesn't make the browser support cors.

If the browser does not support cors, then my library tries to use IE's XDomainRequest object to make the cors request. Setting it to true is just overriding that check within jQuery so it always returns true which is bound to have some funny side effects.

So I'm a bit confused at how setting it is making things work for you. The only result in doing so would be to bypass use of IE's magic cross domain request object in my library, thereby making any cross domain requests on IE fail.

In any event, if you can give me a bit more info, a code snippet, or a pull request I can look into this, otherwise it sounds like you probably want to check a bit more about your IE support as I suspect it's probably not working as expected.

aroc commented

Hey @victorquinn - you're absolutely right about the $.support.cors thing. I still remained unable to get this plugin working without it, so I switched to using this project: https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest