188

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.

Matt
  • 70,063
  • 26
  • 142
  • 172
cmplieger
  • 6,375
  • 15
  • 49
  • 80

1 Answers1

241

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.

Erik Dahlström
  • 54,515
  • 11
  • 110
  • 127
  • 1
    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. – Erik Dahlström May 17 '13 at 08:31
  • 2
    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 – Robert Petz Mar 20 '14 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 Oct 20 '14 at 18:55
  • @AlexStack that sounds unrelated to this answer, please post a new question instead, or better yet - file a bugreport at http://crbug.com with a complete testcase. – Erik Dahlström Oct 21 '14 at 08:19
  • @ErikDahlström : Presto based Opera does not render ꜱᴠɢ fonts served with an image mime type. – user2284570 Aug 30 '15 at 13:51
  • @user2284570 pretty sure svg webfonts work in Presto, there's no other supported mime type for svg. If it's Opera Mini you mean then note that it doesn't support webfonts at all, regardless of the font format. Feel free to post a testcase, here's one that shows that it works: http://dev.w3.org/SVG/profiles/1.1F2/test/svg/fonts-elem-03-b.svg – Erik Dahlström Aug 30 '15 at 15:26