mrsum / webpack-svgstore-plugin

Simple svg-sprite creating with webpack
https://www.npmjs.com/package/webpack-svgstore-plugin
200 stars 92 forks source link

Async loading svg sprite won't work on IE9 because of XDomainRequest #103

Closed kazagkazag closed 8 years ago

kazagkazag commented 8 years ago

There is a block of code in svgxhr.js...

if (typeof XDomainRequest !== 'undefined') {
    _ajax = new XDomainRequest();
}

With that in source code my icons won't load in IE9 and IE10. _ajax.onerror throws error but there is no error message, so I don't know why it doesn't work. But! When I commented this out, icons appeared! IE9 can use XMLHttpRequest as well.

As far as I know, XDomainRequest is some kind of sub-standard introduced by MS years ago. Do you really need that in this file? It seems, that it brokes loading SVG on old IE...

Any help, guys?

I use nginx to server my files and I run IE9 on VirtualBox (I work on Ubuntu 16.04), if that matters.

mrsum commented 8 years ago

@kazagkazag Hello. You can override loader function into your project.

BTW. copy ajax helper svgxhr.js file.

alexiscordova commented 7 years ago

Looks like there may have been a regression for this. In version 4.0.0, the XDomainRequest type check block has returned, and I can confirm it causes the XHR to fail—causing the SVGs to not display—in at least IE 10. Commenting this block out displays the SVGs as expected.