Table of Contents

Data URL

This is a PHP script that will load the specified HTML document and convert it to a data URL. It's Useful for generating off-line web apps, especially for the iPhone. It makes 3 passes which do the following.

  1. Convert JavaScript to data: URL's
  2. Convert Images to data: URL's
  3. Convert the whole document to a data: URL

It does not currently convert linked CSS but adding that should be trivial.

Download (data.zip)

img2data

This is a modified version of the code which converts only url's in <img> tags into data. This base_64 encodes the binary image data and embeds that data into the HTML file itself. Here's how you use it.

img2data.php index.html > combined.html

That command reads index.html, parses all of the included images, and stores the result in combined.html.

Download (image2data.zip)

License

This source code is distributed under the MIT License.