Search code examples
javascriptjqueryajaxbackbone.js

Backbone.js wont sync in IE only


Has anyone ever seen this? I don't how to expand on this. It's the only symptom. It will not sync in IE.


Solution

  • Cross Domain requests in IE are supported via only the IE-specific object called XDomainRequest. XDomainRequest is too basic when compared with the XMLHTTPRequest object that's implemented in all other major browsers!

    I am guessing you are using jQuery for Ajax-requests. jQuery does not use the XDomainRequest for making Cross-Domain calls on IE, so you are out of luck!

    XDomainRequest offers only a subset of XMLHTTPRequest's features. For example, it is impossible to insert any custom headers to the HTTP-Get/Post requests, via XDomainRequest [typically you would use the jQuery's "onBeforeSend" callback for this purpose].

    Please refer to this MSDN documentation: http://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx.

    I encountered all these in my current project and finally ended up using a Proxy i.e. mod_proxy, on the Apache server that's hosting my app. Please have a look at my related answer on this topic How to make an ajax request to an API using CORS and backbonejs