In HTML 4.0, binary objects (e.g. image) can be inlined with Base64 encoding:

<img src="data:image/gif;base64,R0lGODlhDwAPAKECAAAAzMzM/////
alt="Base64 encoded image" width="150" height="150"/>

However, IE totally ignores the standard. Even in IE7, base64 image is still not supported.

Available Solutions

Dean Edwards uses JavaScript to post the Base64 content back to the server and decode to the original binary. However, it is only good for small images. If it is a large image, this solution will use a lot of bandwidth (retrieve HTML with Base64 data, post the Base64 data to the server, retrieve the decoded binaries). Also, if implementing a simple stateless solution with GET, the Base64 data will be limited to 1KB.

Luiz Angelo De Luca, on the other hand, exploited the capability of reading MHTML in IE with a simple PHP script. Base64Html is the implementation of this solution in Java.


Base64Html utilizes the following libraries: