prismicio / javascript-kit

Development kit for the Javascript language
https://developers.prismic.io
106 stars 69 forks source link

Fixing an issue happening on IE9 #91

Closed menthena closed 9 years ago

menthena commented 9 years ago

The application is completely breaks on IE9. Giving xhr is not defined error. With removing this code, it works fine. Tried replacing xhr with xdr, didn't work - I also tried to define xhr for that to work, however it didn't work.

erwan commented 9 years ago

We can't just ignore the cache control, we need to read the ttl from the header to cache the content correctly.

And xhr is defined just above, I don't see why it would be undefined on IE9: https://github.com/menthena/javascript-kit/blob/master/src/utils.js#L11

menthena commented 9 years ago

Erwan,

On IE9, the code is trying to request the data using XDR and basically XDR doesn't have getResponseHeader function. Trying to get the header with XHR doesn't really makes sense when you make the request with XDR. Even XHR would give the headers, XHR is defined is outside of the block therefore _xhr_ variable is not accessible and it is saying xhr is not defined on IE9.

https://github.com/prismicio/javascript-kit/blob/9e69b33e0e08e0a207dc727fee35e72abb2c0cb8/src/utils.js#L64

erwan commented 9 years ago

Oh, I understand better now. Taking a look at how we can fix it.

erwan commented 9 years ago

Just removed all cache for IE9. The browser has its own cache anyway.

Does that look good for you?

https://github.com/prismicio/javascript-kit/commit/e968bb5d47b5fb2f474cd066e573e200f668cf74

menthena commented 9 years ago

Yes, thank you.

erwan commented 9 years ago

cool, I cut a release