Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome not showing a SVG file

I have a SVG ilustration embeded in an HTML5 file which works in all modern browsers when I try it on local, but when I try to serve them from the web I dont get Chrome to render the SVG image, it only renders the SVG source code. I already added this lines to an .htaccess file which solved the issues in Safari and Firefox:

AddType image/svg+xml svg
AddType image/svg+xml svgz
AddEncoding x-gzip .svgz

But Chrome now is the only browser that doesn't render the image when comes from the web. My local file works fine even in Chrome.

What am I missing?

Here is the link to the sample of the issue, try it on Safari and Firefox, it will work. But in Chrome the story is different.

EDIT: Link was broken and seems to be missing www. prefix: http://www.getformgallery.com/demo/gos-form.html

like image 701
user661987 Avatar asked Mar 16 '11 06:03

user661987


2 Answers

I have the same problem. Before some Chrome updates the svg I used in my site works but from certain Chrome updates those svg didn't worked and the page won't load either, just loads for 1-2s and then redirected to Aw, snap.

Finally I figure it out. You have to define "width" and "height" in Object tag eg.

<object height="100%" width="100%"data="images/image.svg" type="image/svg+xml"></object>
like image 73
Niraj Shakya Avatar answered Oct 16 '22 03:10

Niraj Shakya


Did you export the SVG from Photoshop using an extension like SVG Hero? If so, did you export a smart object? I had the same problem, but fixed it by saving the SVG from Illustrator instead. Now my SVG works in all browsers.

like image 20
rjtkoh Avatar answered Oct 16 '22 02:10

rjtkoh