SVG images not displaying on certain web servers
The SVG image should be getting served with MIME type image/svg+xml, so I would recommend checking that first. One way to check the MIME type being served is to use wget to get the image. Here's an example of the output of wget. Note where it displays the MIME type:
jacob@jacob-laptop:~/tmp$ wget http://croczilla.com/bits_and_pieces/svg/samples/butterfly/butterfly.svg
--2011-07-25 11:32:04-- http://croczilla.com/bits_and_pieces/svg/samples/butterfly/butterfly.svg
Resolving croczilla.com... 77.92.68.237
Connecting to croczilla.com|77.92.68.237|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 31187 (30K) [image/svg+xml]
Saving to: `butterfly.svg'
100%[====================================================================>] 31,187 84.5K/s in 0.4s
If the MIME type is image/svg+xml in both cases, then I would diff the content of both documents to see if there are differences between them.
Also, while this does not answer your question, you should also be aware that not all browsers support using an HTML img tag to render SVG. The reason for this is that, typically, img tags have used less security than object or embed tags. You can read here for more info on this: Reliably detecting <img> tag support for SVG
jbeard4 answer is right, but I'd like to complement it: in order to fix, you'd have to make your server serve SVG images as image/svg+xml
. On Apache, you can do that by adding these two lines to .htaccess
:
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
Via http://kaioa.com/node/45