iconic/SVGInjector — pull request #20 by PrototypeAlex (2014-11-19 00:30:08+00:00)
Title: Add CORS initiation to XHR request object

Adds CORS to the request for the SVG file, only if the server supports it will this effect the request.

If you're loading this script from outside of your domain, or your svg files live on a different server/domain than where the javascript file originates from then you'll probably run into cross origin request issues. This patch solves that by adding CORS to the xhr request, i.e. adding the ORIGIN header to the GET request.

If CORS isn't supported then an error will occur, but this is OK, because if the browser doesn't support CORS, then it doesn't support SVG, looking at IE specifically, there could be edge cases to this? If there is, and you're reading this, please ping me and I'll write a condition for the browser in question.