views:

385

answers:

1

What is the best way to embed images in a single html file in IE?, i don't want a round trip request to a PHP file to decode the base64 data.

I read about MHTML, is that the only way?

if yes, how can I resolve the style "background-image: url(images/top.png);"?

Regards, Manoj

+2  A: 

Take a look at Data URI Scheme

**edit**

The above will not work in IE 6-7. MHTML is supported only by IE and you can view examples of how to implement here: MTHML text messages. However, I would recommend against this as it can get very messy and its not widely supported.

You could think about using CSS sprites to combine multiple small images into one. Techniques about how to do this are scattered all round the net. Here is an excellent guide: CSS Sprites: Image Slicing’s Kiss of Death

Gary Green
This won't support in IE 6-7.
Yes, it's not supported in IE6-7 I'm afraid. In which case you could check to see if the browser is IE 6-7 and silently load images from files. Alternatively, link to firefox for them to download ;)
Gary Green