3

I use chrome to visualize a svg file which I put on a server, that works fine. Here's the dead simple html for it:

<a href="test.svg">svg</a>

However, when I try to use svgz instead, it doesn't work. Here's the code I use:

<a href="test.svgz">svgz</a>

Here the error:

This page contains the following errors: error on line 1 at column 1: Encoding error Below is a rendering of the page up to the first error.

Looks to me that the browser doesn't decompress the file first. Any idea how can I make this (much smaller) svgz file to display nicely on my browser?

James A Mohler
  • 11,060
  • 15
  • 46
  • 72

3 Answers3

3

I had to add a .htaccess in the web folder root with the following content:

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

From those 2 links here and here

  • Actually that stopped working (same error message. I don't understand what's going on...) –  Aug 06 '09 at 11:20
  • Many, many thanks. This, in conjunction with enabling mod_filter (and of course deflate_module and the corresponding `AddOutputFilterByType DEFLATE image/svg+xml`) was the only think that worked after digging across the entire internet. – Pere Jul 20 '20 at 22:21
1

The info on this page solve my problem with IIS http://forums.iis.net/t/1175276.aspx/1

<system.webServer>
  <rewrite>
    <outboundRules>
        <rule name="Rewrite SVGZ header" preCondition="IsSVGZ" stopProcessing="true">
            <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
            <action type="Rewrite" value="gzip" />
        </rule>
        <preConditions>
            <preCondition name="IsSVGZ">
                <add input="{PATH_INFO}" pattern="\.svgz$" />
            </preCondition>
        </preConditions>
    </outboundRules>
  </rewrite>
  <staticContent>
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    <mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
  </staticContent>
</system.webServer>
0

It looks like it's fixed in build 13536 and greater ⟨http://code.google.com/p/chromium/issues/detail?id=9737⟩ so I guess you just have to upgrade the browser?

Nietzche-jou
  • 14,415
  • 4
  • 34
  • 45