What are the pitfalls of using SVGZs instead of SVGs?
I recently started using svg images in my sites. Some of them are complex and quite big, so I've started compressing them. They compress really well.
Why would one ever not use SVGZs (instead o开发者_运维技巧f the uncompressed version)? Are there well-known pitfalls that I should be aware of?
As long as your webserver sets the proper Content-Encoding HTTP header it should work in all browsers that support SVG.
The one pitfall I know of is if you want to be able to open the svgz files from disk locally (that is: without using a webserver). That doesn't work in all browsers.
Also if your svg files are big, then you should consider preprocessing them with SVG Scour or similar. It's rather common to see vector graphics editors such as Illustrator and Inkscape output display-redundant data in the files (binary blobs or custom xml markup).
Is it for desktop browsers, mobile? I know Opera supports SVGZ natively since 8.0 at least (maybe even earlier).
What server? Apache, IIS? You might have to configure it and/or mess with .htaccess. Here's a howto for Apache: http://kaioa.com/node/45
Keep in mind that the server might be already serving your content compressed, if your client supports it, as SVGZ is just a normal SVG with gzip compression applied.
精彩评论