最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - How to decompress SVGZ with JavaScript? - Stack Overflow

programmeradmin0浏览0评论

I'm trying to set up this world map using SVGZ instead of SVG so I can give my users a richer, more detailed map.

So far I've tried depressing it using js-deflate, but to no avail.

I'm trying to set up this world map using SVGZ instead of SVG so I can give my users a richer, more detailed map.

So far I've tried depressing it using js-deflate, but to no avail.

Share Improve this question edited Dec 1, 2015 at 23:12 James A Mohler 11.1k15 gold badges50 silver badges76 bronze badges asked Sep 22, 2011 at 6:02 Badgeman 3000Badgeman 3000 811 silver badge9 bronze badges 2
  • SVGZ uses gzip for pressing. Browser doesn't depress SVG without assistance? – Andrew D. Commented Sep 22, 2011 at 6:27
  • Please don't ask the same question over and over. Also, if you cannot ask a question without redirecting people to your website, then that question isn't acceptable here. – user1228 Commented Oct 18, 2011 at 11:40
Add a ment  | 

3 Answers 3

Reset to default 5

If you want the SVG file inside of the SVGZ, you gunzip it (it's a renamed archive):

cp file.svgz file2.svg.gz
gunzip file2.svg.gz

If you want to use a SVGZ image, then you might run into trouble. I think some browsers support it (virtually all support Gzip pression), but I doubt many do (if any at all).

As I write in ment SVGZ uses gzip. Top browsers can depress gzip files without assistance. Your page http://home.no/dwaynie/map load .svgz file with Content-Type:text/plain; charset=ISO-8859-1. But for SVG|SVGZ it's not valid MIME type.

svg     Content-Type: image/svg+xml

svgz    Content-Type: image/svg+xml
        Content-Encoding: gzip

Above headers must be configured in web server (IIS, Apache).

Just below the map on the page you refer to there's a link to Wikipedia that explains what it is: an SVG file pressed with gzip.

For pleteness sake: gzip and (pk)zip are not the same format, but Windows tools like WinRAR and 7-Zip understand gzip as well as zip. Every Linux distro probably has gzip/gunzip installed by default.

发布评论

评论列表(0)

  1. 暂无评论