Browser Won’t Display SVG Locally?

Ok here’s the sitch.

You can pull in svg from a cdn and everything work. But when you try and use your local svg graphics, everything goes to shit.

It’s probably that you’re not serving svg in with the right headers, especially if you’ve saved your svg graphic from illustrator. There’s a great explanation here: http://kaioa.com/node/45

If you’re running XAMPP do the following:

[pastacode lang=”bash” message=”” highlight=”” provider=”manual”]

pico /Applications/XAMPP/etc/httpd.conf

[/pastacode]

And add the following to: ”

<IfModule mime_module>

[pastacode lang=”bash” message=”” highlight=”” provider=”manual”]

# add support for svg
    AddType image/svg+xml svg svgz
    AddEncoding gzip svgz

[/pastacode]

Restart XAMPP and you should be serving svg!

 

 

One thought on “Browser Won’t Display SVG Locally?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.