There’s a neat trick — you might have seen it in Lee Semel’s 5k Wolfenstein game for the 5k competition — where you can embed images directly in a page, rather than have the image data in separate files. Semel demonstrated with XBM images, which are black-and-white image files that (if you look at the image data in the file) actually look like C code defining the image. (See Semel’s notes above for more on this.)
So, thought I, that should work with non-XBM images too, right? I mean,
if we can do
function return C code for an array, there’s no reason why it can’t
return binary data that makes up a GIF or PNG image, right? Right? Well,
Is there an image here? ()
All I’ve done there is made the
src attribute of an
img tag be a
based browser, you should see a little red ball. If you’re using
IE…broken image. Damn. I’m not the first guy to discover this, either.
Roger Critchlow wrote an essay about inline images on web pages,
offering a few other ways that it might work (data: URLs,
document.write, others). And, guess what: they all only work in
Mozilla. IE, not a chance. So, it’s not possible to embed images in a
web page if that page is to be displayed in IE.