Coder Perfect

Right mime type for SVG images with fonts embedded

Problem

This is the standard SVG mime:

image/svg+xml

It’s also really effective. Chrome, on the other hand, informs you that the mime type is improper when embedding an SVG font, presumably because you return a font rather than an image.

Is there such a thing as a universal mime type? Is there something wrong with Chrome? Is there a way to accept application/svg+xml?

This is probably still a gray area in HTML5, but someone here may know.

Asked by cmplieger

Solution #1

There is only one registered mediatype for SVG, which is image/svg+xml, as you mentioned. Of course, you may provide SVG as XML as well, however some browsers will behave differently in certain contexts if you do so. For example, I’ve encountered examples where SVG used in CSS backgrounds fails to appear unless served with the image/svg+xml mediatype.

Answered by Erik Dahlström

Post is based on https://stackoverflow.com/questions/11918977/right-mime-type-for-svg-images-with-fonts-embedded