如果压缩和块传输,SVG 可以部分渲染吗?
我有一些大型的、动态生成的 SVG,它们通过相对较慢的互联网连接提供服务。我正在尝试优化它们,使其尽快可见。如果我将服务器设置为 Content-Encoding: gzip 和 Transfer-Encoding: chunked,任何 SVG 查看器都会利用它并在传输时部分渲染它吗?如果没有,是否有其他方法让它按流渲染?我可以将其分成几个 SVG 部分,但这将是一项繁重的工作,我希望服务器设置...
最常见的用户使用 IE7 和 Adobe SVG Viewer 插件。
我怀疑这是否重要,但我正在使用 C#/ASP.NET 和 IIS6 提供服务。
I have some large, dynamically generated SVGs that are being served over a relatively slow internet connection. I'm trying to optimize them to be viewable as fast as possible. If I set the server to Content-Encoding: gzip and Transfer-Encoding: chunked, will any SVG viewers take advantage of that and render it partially, as it is transferred? If not, are there other ways to get it to render as-it-streams? I could break it up into several SVG pieces but that will be a lot of work, I was hoping for server settings...
The most common users use IE7 with the Adobe SVG Viewer plugin.
I doubt it matters but I'm serving with C#/ASP.NET and IIS6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SVG 是可流式传输的(以及 gzipped 分块编码),因此理论上可以仅显示部分下载的文件。
我不知道IE+SVG是否真的做到了。测试一下!做一些相当于:
并看看它是否有效。
SVG is streamable (as well as gzipped chunked encoding), so theoretically it is possible to display only partially downloaded file.
I don't know if IE+SVG actually does it. Test it! Do something equivalent of:
and see if it works.
看来至少在 Chrome 和 Firefox 中,SVG 在直接显示或在
内显示时确实会部分渲染,但在
中它不会渲染直到满载。
It seems that at least in Chrome and Firefox SVG does render partially while being displayed directly or inside an
<iframe>
, but in an<img>
it is not rendered until fully loaded.