数据 uri:s 的 MSHTML 后备
我的网站使用数据 uri:s 来减少对我网站的 HTTP 请求数量。问题是 data uri:s 在我们必须支持的浏览器 IE7 中不起作用(不,我们不需要 IE6)。我已经按照 Stoyan 的指南 进行操作,并且实际上让它工作了,但是经过一段时间后最近的 Microsoft 安全更新(KB2544893,如 对原始文章的评论)后备似乎已停止工作。
上面引用的评论建议我应该尝试发送带有 Content-Type message/rfc822 的 MSHTML 文件,但我也无法让它工作,并且我在几个小时的过程中尝试了多种不同的方法。
所以我的问题是这样的:你能让 Stoyan 描述的技术以某种方式发挥作用吗?我真的很感激一个有效的例子来让我相信这确实是可能的。
My site uses data uri:s to reduce the number of HTTP requests to my site. The problem is that data uri:s don't work in IE7, a browser that we have to support (No, we don't need IE6). I've followed Stoyan's guide and actually gotten it to work, but after a recent Microsoft security update (KB2544893, as descibed in a comment on the original article) the fallback seems to have stopped working.
The comment referenced above suggests I should try sending the MSHTML file with Content-Type message/rfc822, but I can't get this to work either, and I've tried multiple different ways over a course of several hours.
So my question is this: Can you get the technique described by Stoyan to work somehow? I would really appreciate a working example to convince me that it truly is possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我个人会使用条件样式。在您的主要标记中 - 按如下方式启动:
在您的 css 中,您现在可以执行以下操作:
和
更新
除了下面的评论之外,如果您担心 IE7 性能 - 一个可靠的方法是使您的IE7 后备图像精灵。
这样您只需为 IE7 用户进行 1 次额外的 HTTP 调用:
Personally I would use conditional styles. In your main markup - start it as follows:
In your css you can now do:
and
UPDATE
Further to the comments below, if you're concerned around IE7 performance - a reliable approach would be to make your IE7 fallback image a sprite.
That way you're only making 1 additional HTTP call for IE7 users:
我联系了 Stoyan Stefanov(该技术的原作者),他修复了原来的示例,使其现在可以正常工作。只需添加“message/rfc822”作为内容类型即可。
固定示例: http://www.phpied.com/files/datasprites/testhover2.html< /a>
我让他在这里发表评论,这样我就可以奖励积分,但他不愿意。
I got in contact with Stoyan Stefanov (the original author of the technique), and he fixed his original example so it now works. Simply adding "message/rfc822" as content-type was all that's needed.
Fixed example: http://www.phpied.com/files/datasprites/testhover2.html
I asked him to post a comment here so I could award the points, but he didn't want to.
http://www.phpied。 com/mhtml-when-you-need-data-uris-in-ie7-and-under/ 这是我认为的解决方案
http://www.phpied.com/mhtml-when-you-need-data-uris-in-ie7-and-under/ here's your solution i think