signalpoint / jDrupal

A JavaScript Library and API for Drupal Applications
http://jdrupal.tylerfrankenstein.com/
GNU General Public License v2.0
76 stars 38 forks source link

IE9 Compatibility #45

Closed dorianboulch closed 8 years ago

dorianboulch commented 8 years ago

Hi,

I've just met an error with IE9, XMLHttprequest doesn't work properly while connecting.

jdrupal.js (line 355) var result = JSON.parse(req.response);

To ensure compatibility, it should be :

var result = JSON.parse(req.responseText);

signalpoint commented 8 years ago

@dorianboulch Is this for jDrupal 7 or 8?

Do you happen to have a little snippet that can first check to see if it is IE9? I'd like to only make that change for IE9, and not all other browsers.

kentr commented 8 years ago

@signalpoint Looks like responseText is in the spec, so maybe using it more generally would be ok.

Something like this?

// If req.responseText has data, use it.
// Else if req.response has data, use it (avoid breaking any browsers that currently work but don't implement responseText).