Saving a web page in a single file

I was in need of archiving some web pages and was looking for an easy solution. Google Chrome allows exporting a web page with images and styling—even if they are loaded in via different URLs—as a single archival format called MHTML.

On macOS, go to File > Save Page As and select Webpage, Single File from the Format: dropdown.

This works and it gets the styling right and to my surprise, even saves the contents of embedded <iframe> elements. But, it lacks the ability to bundle up video and audio files. There is also no option to somehow force it to try and bundle scripts even though I can understand why that might not work in a lot of scenarios. Lastly, I can’t seem to open the resulting .mhtml file in Safari or Firefox. So, this is a Chromium-only solution.

A quick googling led me to SingleFile, which is a chrome extension that addresses all of those pain points. You can customize the things the extension tries to roll up into a single HTML file which works in all browsers:

It’s a lot easier to use: just click the extension and it bundles and adds it to your Downloads folder.

My guess was right in that this encodes all the information as Data URLs (even videos!) which is how everything is kept in a single HTML file. I’m not super sure if this solution scales for large web pages but this works fine for my current needs.