开发者

Images in one file under IE6 WITHOUT php

开发者 https://www.devze.com 2023-02-25 09:02 出处:网络
I need to create a page with all images and CSS in it, so it would be only one file. I know that there is something like MHT (IE web archive), BUT there is problem. It works only in IE and Opera, no

I need to create a page with all images and CSS in it, so it would be only one file.

I know that there is something like MHT (IE web archive), BUT there is problem. It works only in IE and Opera, not in FF. And i need my page to be working in all IEs (6+), Opera and FF. I know there is a way to encode my images in base64 and I also know, that IE 6 and 7 does not support data URLs. I've seen Dean Edward's t开发者_JS百科rick for IE 6 and 7 but it works only with PHP support. And I can't use PHP, so this isn't working for me.

So, is there any way to create this kind of page? Please don't give me answers like "who is using IE6 today" or "install chrome frame". I know all this, but I need it to be working this way.

Thanks for the answer!


There is no cross-browser way to integrate all resources into one HTML file.

Your best bet is probably to serve a .MHT file for IE, and one with data: URIs for Firefox et al.

In some situations, a viable compromise may be serving a ZIP file that contains all resources, referenced using relative URLs. The user just has to unpack it, and can view it locally.


I can only think of one solution that will work in all browsers, and that is building an image from html elements, but it will be very much work to do so (per pixel or other strategy). Maybe jQuery can help a little. Also this might slow IE6 down (even more than normal...)

example: http://jsfiddle.net/huSq3/1/

I know it isn't much of a solution but I had to mention it. Now I'm thinking of it maybe you can use the canvas tag in combination of this javascript library for IE and draw the images to that via javascript.


Maybe you could use html conditional comments to decide which solution to use between MHT, data url, or any other partially supported solution...


If you are OK with the base 64 string in the image tag, then just hardcode it, then you do not need php

0

精彩评论

暂无评论...
验证码 换一张
取 消