Published at
Updated at
Reading time
This post is part of my Today I learned series in which I share all my web development learnings.

Last week I attended my first IndieWebCamp in Berlin. In case you don't know IndieWeb on their site is written that IndieWeb is "a people-focused alternative to the 'corporate web'".

But what does that mean? It focuses on three things:

  • owning your own data
  • connecting of websites without third parties
  • giving control to people doing things in the web

These three points are huge so when you're interested in learning more check their site. IndieWeb has very interesting ideas and technologies that are definitely worth a look.

But back to topic... at the event I learned about MHTML. What is that?

MTHML stands for MIME Encapsulation of Aggregate HTML Documents and it's purpose is to archive a particular site. The idea of this format is to include all needed resources in a single document so that you really have a complete state when saving it as .mhtml. This way you can e.g. document the progress or the evolution of a site quite nicely.

I gave it a shot and what I first discovered is that .mthml files are actually saved as HTML emails which is interesting.

From: <Saved by Blink>
X-Snapshot-Version: 1.0
X-Snapshot-Title: =?utf-8?Q?Stefan's web dev journey?=
Subject: Stefan's web dev journey
Date: Mon, 12 Nov 2017 13:17:49 -0000
MIME-Version: 1.0
Content-Type: multipart/related;

Content-Type: text/html
Content-ID: <frame-13493-e50f0bd6-1ad1-433e-bfa0-183a29bb6670@mhtml.blink>
Content-Transfer-Encoding: quoted-printable

&lt;!DOCTYPE html&gt;&lt;html data-n-head=3D"lang" lang=3D"en" class=3D"gr__stefanju=

Going further I checked how images are included in the document.

&lt;!-- I have no idea how this works --&gt;
&lt;img src=3D"https://images.contentful.=
ck-photo-227882431.jpg?w=3D150" alt=3D"Stefan Judis" class=3D"c-person__ima=
ge" width=3D"142" height=3D"142"&gt;

I expected images to be inlined in the image elements but they are not. You can find the images inlined at the end of the file.

Content-Type: image/jpeg
Content-Transfer-Encoding: base64


I don't really understand how this works technically but I think it's good to know that you can safe a complete website in a single document. Maybe I start archiving my own site every month? :D

If you want to start using .mhtml check the Wikipedia entry. It describes how you can use it in your browser of choice.

Was this TIL post helpful?
Yes? Cool! You might want to check out Web Weekly for more quick learnings. The last edition went out 4 days ago.
Stefan standing in the park in front of a green background

About Stefan Judis

Frontend nerd with over ten years of experience, freelance dev, "Today I Learned" blogger, conference speaker, and Open Source maintainer.

Related Topics

Related Articles