So many posts out there on backbone js model fetch not working in IE8. Always produces error callback. Succeeds everywhere else: IE10+, Chrome, FF, Safari, etc. Just not in IE8.
One problem in solving the issue is the lack of detail available in the error callback. Thought something like below would give me some details but it doesn't:
myModel.fetch({
success: (function () {
//do stuff
}),
error:(function (e) {
alert('Fetch error message: ' + e.toString());
})
});
Just produces output [object Object]. Even when I set a break in VS and inspect the error object there are no details in it.
So without details on the error I start guessing.
I see lots of posts that say something like "IE8 and 9 only support CORS in a non-standard way" or "IE10 uses XMLHTTPRequest and IE8 uses the legacy XDomainRequest object". The solutions recommended in these posts say, in essence, use XDomainRequest if you must support IE8. But backbone is handling ajax under the hood. One of its benefits obviously. I assume I'm supposed to tell backbone somehow to conditionally use XDomainRequest if we're in IE8. How do I do this?
I tried the Backbone.CrossDomain library (https://github.com/victorquinn/Backbone.CrossDomain) which purports to do this for you. Just include the library after backbone and backbone cross domain fetch just magically works. Tried it and didn't work for me. Still produces the same error callback with no details, so no way to really troubleshoot the reason the failure.