Web dev question: bundling html files

I’m attempting to develop some web pages and I’d like for the files to be self-contained. In other words, instead of an .htm file with a couple of .gif, .jpg, and .css files, I’d like a single file that encapsulates all this stuff.

I have a guarantee that everybody will be using the latest version of IE to see these things, so I can cheat a little on web standards.

Is this possible? The google, it does nothing!

What you ask would not be a web page. It would be an Adobe PDF document, or something similar.

And since I don’t use the latest version of IE, I would never be able to see it. :stuck_out_tongue:

With CSS, you can just put it all in <style></style> tags at the top of the document.

As for skirting the images issue…I don’t see how this can be done. An image file is an image file. The image file needs to exist somewhere. You could obviously use an absolute link to any image file you want (img src=http://somedomain.com/image.jpg) but image.jpg does need to exist somewhere in the world. Somewhere connectable, that is. Plus, with an absolute link, if you’re using http, the viewer does need an internet connection to see it.

You could just not use image files. Make everything text-based and use some nice CSS to enhance the look.

Or, make a PDF file.

It sounds like flash would satisfy your needs. Although I hate flash… I think websites that are nothing more than flash apps are next to unusable. Nevertheless, you can embed all your images and “pages” into a single swf file and it will open in IE… you can even give them little forward and back buttons so you won’t use too much functionality.

As mentioned, what you describe wouldn’t be a web page. That’s not how HTML works.

Easier than Flash or PDF would be to build the web page normally on your local machine, then take a screenshot of it, save it as a web-usable (JPG or GIF) image, and use that.

In most modern browsers, except for MSIE, images and other binary data can be embedded inside HTML files using the data: URI scheme.

If you only want to support MSIE (and perhaps Opera) you can try using MHTML.

Too bad neither will satisfy the OP’s requirements.

data: URI scheme: “Microsoft’s Internet Explorer, as of versions 6 and 7, lacks support.”

MHTML: “There is a security vulnerability associated with opening MHTML files in IE7 due to an error in the handling of redirections for URLs with the “mhtml:” URI handler.”

If using asp.net, you could package all of your html files, css files, images, etc. as resources in a .net assembly. You’d have to write a custom http handler to respond to requests for pages by serving them out of your resources, and to the browser it would look exactly like any other html page, although with a custom extension. You’d have just one dll file to deploy to your \bin folder, and some IIS configuration to match a file type to that http handler (which would also be contained in the same assembly).

BUT, you will pay a performance penalty, and maintenance of your site becomes more of a hassle because you have to rebuild and redeploy your assembly for the tiniest of changes. You’re also talking about a bit of coding work - not a ton if you’re just serving static content, but you’ll want it done with a good understanding of asp.net. There doesn’t seem to be much gain in going this route.

Thanks for the advice, by the way.

MHTL seems like a possible option (since these files are only going to be available from an intranet site, I’m not too worried about security). The only problem I see with MHTML is that I can’t get relative links to work, which is a pain.

I wonder if it would help if you could give us some idea of why you want to do this? I mean, what is it that you hope to accomplish that doesn’t work with the traditional HTML, CSS, and image files?