245

This is the usual SVG mime type:

image/svg+xml

And it works great. However, when embedding an SVG font, chrome tells you the mime type is incorrect, obviously because you return a font instead of an image.

Is there any universal mime type? is chrome wrong? is application/svg+xml accepted somehow?

I guess this is still a gray area in HTML5 but someone here might know.

0

1 Answer 1

325

There's only one registered mediatype for SVG, and that's the one you listed, image/svg+xml. You can of course serve SVG as XML too, though browsers tend to behave differently in some scenarios if you do, for example I've seen cases where SVG used in CSS backgrounds fail to display unless served with the image/svg+xml mediatype.

6
  • 2
    I assume the warning is there for purity's sake, there's no registered mediatype like font/svg+xml or similar at the moment however (in theory any mediatype ending with +xml should work as long as the svg content is correct). If Chrome (or the webkittens) want to push for a new mediatype just for svg fonts I've not seen such a request on the www-svg mailinglist yet. Commented May 17, 2013 at 8:31
  • 3
    As an FYI to anyone reading this chain now - it doesn't seem like Chrome throws a warning for the mimetype anymore when delivering an SVG font with the 'image/svg+xml' mimetype Commented Mar 20, 2014 at 17:17
  • I have a google chrome extension that uses SVG backgrounds. As of Chrome 38, the backgrounds all of a sudden broke and now I have to release a new version to fix that (no idea how though, that's why I'm here!)
    – AlexStack
    Commented Oct 20, 2014 at 18:55
  • @AlexStack that sounds unrelated to this answer, please post a new question instead, or better yet - file a bugreport at crbug.com with a complete testcase. Commented Oct 21, 2014 at 8:19
  • @ErikDahlström : Presto based Opera does not render ꜱᴠɢ fonts served with an image mime type. Commented Aug 30, 2015 at 13:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.