MHTML
   HOME

TheInfoList



OR:

MHTML, an initialism of "
MIME Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of email messages to support text in character sets other than ASCII, as well as attachments of audio, video, images, and application programs. Message ...
encapsulation of aggregate
HTML The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaSc ...
documents", is a
Web archive file A web archive file is an archive file that contains the entire content of a web page; some file formats can store more than one web page, such as the Mozilla Archive Format. A single web page can contain several resources such as images, animations, ...
format used to combine, in a single
computer file A computer file is a computer resource for recording data in a computer storage device, primarily identified by its file name. Just as words can be written to paper, so can data be written to a computer file. Files can be shared with and trans ...
, the HTML code and its companion resources (such as images) that are represented by external hyperlinks in the web page's HTML code. The content of an MHTML file is encoded using the same techniques that were first developed for
HTML email HTML email is the use of a subset of HTML to provide formatting and semantic markup capabilities in email that are not available with plain text: Text can be linked without displaying a URL, or breaking long URLs into multiple pieces. Text is ...
messages, using the MIME content type multipart/related. MHTML files use an .mhtml or .mht
filename extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically ...
. The first part of the file is an
e-mail header Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic (digital) version of, or counterpart to, mail, at a time when "mail" meant ...
. The second part is normally HTML code. Subsequent parts are additional resources identified by their original
uniform resource locator A Uniform Resource Locator (URL), colloquially termed as a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifi ...
s (URLs) and encoded in
base64 In computer programming, Base64 is a group of binary-to-text encoding schemes that represent binary data (more specifically, a sequence of 8-bit bytes) in sequences of 24 bits that can be represented by four 6-bit Base64 digits. Common to all bina ...
binary-to-text encoding A binary-to-text encoding is encoding of data in plain text. More precisely, it is an encoding of binary data in a sequence of printable characters. These encodings are necessary for transmission of data when the channel does not allow binary ...
. MHTML was proposed as an open standard, then circulated in a revised edition in 1999 as RFC 2557. The .mhtml (Web archive) and
.eml Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic (digital) version of, or counterpart to, mail, at a time when "mail" meant ...
(email) filename extensions are interchangeable: either filename extension can be changed from one to the other. An .eml message can be sent by e-mail, and it can be displayed by an
email client An email client, email reader or, more formally, message user agent (MUA) or mail user agent is a computer program used to access and manage a user's email. A web application which provides message management, composition, and reception functio ...
. An email message can be saved using a .mhtml or .mht filename extension and then opened for display in a
web browser A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used o ...
or for editing other programs, including
word processor A word processor (WP) is a device or computer program that provides for input, editing, formatting, and output of text, often with some additional features. Early word processors were stand-alone devices dedicated to the function, but current ...
s and
text editor A text editor is a type of computer program that edits plain text. Such programs are sometimes known as "notepad" software (e.g. Windows Notepad). Text editors are provided with operating systems and software development packages, and can be ...
s.


Layout

The header of an MHTML file contains metadata such as a date and time stamp, page title, the source URL, and a unique randomized boundary string for separating resources contained within the file. The boundary string is defined at the beginning and used throughout the file.
From: 
Snapshot-Content-Location: https://en.wikipedia.org/wiki/Smartphone
Subject: Smartphone - Wikipedia
Date: Sat, 24 Sep 2022 00:34:32 -0000
MIME-Version: 1.0
Content-Type: multipart/related;
        type="text/html";
        boundary="----MultipartBoundary--GsIBda0vjy2AKIAIliwl7JMwezXDRjDAsLje9khd5l----"
Then, the page resources are contained sequentially, starting with the page's rendered HTML source code. Each resource has its own metadata header which specifies its MIME type and the original location.
------MultipartBoundary--GsIBda0vjy2AKIAIliwl7JMwezXDRjDAsLje9khd5l----
Content-Type: text/html
Content-ID: 
Content-Transfer-Encoding: binary
Content-Location: https://en.wikipedia.org/wiki/Smartphone


The MHTML file ends with a boundary string that is not followed by any data.


Browser support

Some browsers support the MHTML format, either directly or through third-party extensions, but the process for saving a web page along with its resources as an MHTML file is not standardized. Due to this, a web page saved as an MHTML file using one browser may render differently on another.


Internet Explorer

As of version 5.0, IE was the first browser to support reading and saving web pages and external resources to a single MHTML file.


Microsoft Edge

As of switching to the Chromium source code, Edge supports saving as MHTML.


Opera

Support for saving web pages as MHTML files was made available in the
Opera Opera is a form of theatre in which music is a fundamental component and dramatic roles are taken by singers. Such a "work" (the literal translation of the Italian word "opera") is typically a collaboration between a composer and a libr ...
9.0 web browser. From Opera 9.50 through the rest of the Presto-based Opera product line (currently at Opera 12.16 as of 19 July 2013), the default format for saving pages is MHTML. The initial release of the new Webkit/Blink-based Opera (Opera 15) did not support MHTML, but subsequent releases (Opera 16 onwards) do. MHTML can be enabled by typing "opera://flags#save-page-as-mhtml" at the address bar.


Google Chrome

Creating MHTML files in Google Chrome is enabled by default in version 86.


Yandex Browser

Creating MHTML (multipart/related) files in Yandex Browser is enabled by default in version 22.7.4.960 (July 2022).


Vivaldi

Similarly to Google Chrome, the Chromium-based Vivaldi browser can save webpages as MHTML files since the 2.3 release. It supports both reading and writing MHTML files by toggling the "vivaldi://flags/#save-page-as-mhtml" option.


Firefox

Mozilla Firefox does not support MHTML. Until the advent of version 57 ("Firefox Quantum"), MHT files could be read and written by installing a browser extension, such as Mozilla Archive Format or UnMHT.


Safari

From version 3.1.1 onwards,
Apple Inc. Apple Inc. is an American multinational technology company headquartered in Cupertino, California, United States. Apple is the largest technology company by revenue (totaling in 2021) and, as of June 2022, is the world's biggest company ...
's Safari web browser does not natively support the MHTML format. Instead, Safari supports the webarchive format, and the
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
version includes a print-to- PDF feature. As with most other modern web browsers, support for MHTML files can be added to Safari via various third-party extensions.


Konqueror

As of version 3.5.7,
KDE KDE is an international free software community that develops free and open-source software. As a central development hub, it provides tools and resources that allow collaborative work on this kind of software. Well-known products include the ...
's
Konqueror Konqueror is a free and open-source web browser and file manager that provides web access and file-viewer functionality for file systems (such as local files, files on a remote FTP server and files in a disk image). It forms a core part of t ...
web browser does not support MHTML files. An extension project, mhtconv, can be used to allow saving and viewing of MHTML files.


ACCESS NetFront

NetFront 3.4 (on devices such as the Sony Ericsson
K850 The Sony Ericsson K850i is a high-end mobile phone when released in October 2007. It was announced in June 2007 as the flagship product in Sony Ericsson's K ("Kamera") series, with a 5 megapixel CMOS camera sensor. The K850 was the first Sony Erics ...
) can view and save MHTML files.


Pale Moon

Pale Moon Pale Moon is an open-source web browser with an emphasis on customization; its motto is "Your browser, Your way". There are official releases for Microsoft Windows and Linux, as well as contributed builds for various platforms. Pale Moon origi ...
requires an extension to be installed to read and write MHT files. One extension is freely available, MozArchiver, a fork of Mozilla Archive Format extension.


GNOME Web

GNOME Web GNOME Web, called Epiphany until 2012 and still known by that code name, is a free and open-source web browser based on the GTK port of Apple's WebKit rendering engine, called WebKitGTK. It is developed by the GNOME project for Unix-like sy ...
added support for read and save web pages in MHTML since version 3.14.1 released in September 2014.


MHT viewers

There are commercial software products for viewing MHTML files and converting them to other formats, such as PDF and ePub. Some
HTML editor An HTML editor is a program for editing HTML, the markup of a web page. Although the HTML markup in a web page can be controlled with any text editor, specialized HTML editors can offer convenience and added functionality. For example, many HT ...
programs can view and edit MHTML files.


MIME type

MIME type for MHTML is not well agreed upon. Used MIME types include: * multipart/related * application/x-mimearchive * message/rfc822


Other apps


Problem Steps Recorder

Problem Steps Recorder Windows Error Reporting (WER) (codenamed Watson) is a crash reporting technology introduced by Microsoft with Windows XP and included in later Windows versions and Windows Mobile 5.0 and 6.0. Not to be confused with the Dr. Watson debuggi ...
for Windows can save its output to MHT format.


Save to Google Drive extension

The "Save to Google Drive" extension for Google Chrome can save as MHTML as one of its outputs.


Microsoft OneNote

Microsoft OneNote Microsoft OneNote is a note-taking software developed by Microsoft. It is available as part of the Microsoft Office suite and since 2014 has been free on all platforms outside the suite. OneNote is designed for free-form information gathering ...
, starting with OneNote 2010, emails individual pages as .mht files.


Evernote

Evernote Evernote is a note-taking and task management application. It is developed by the Evernote Corporation, headquartered in Redwood City, California. It is intended for archiving and creating notes in which photos, audio and saved web content can ...
for Windows can export notes as MHT format, as an alternative to HTML or its own native .enex format.


Exploits

In May 2015, a researcher noted that attackers could build malicious documents by creating an MHT file, appending an MSO object at the end (MSO is a file format used by the Microsoft Outlook e-mail application), and renaming the resulting file with a .doc extension. The delivery method would be by spam emails. In April 2019, a security researcher published details about an XML external entity (XXE) vulnerability that could be exploited when a user opens an MHT file. Since the Windows operating system is set to automatically open all MHT files, by default, in Internet Explorer, the exploit could be triggered when a user double-clicked on a file that they received via email, instant messaging, or another vector, including a different browser.


See also

* data URI scheme *
Mozilla Archive Format The Mozilla Archive Format (MAFF) is a legacy Web archive file format that was provided by Firefox through an extension, used to store one or more web pages with their associated audio, video, and other related web resources to a single file. ...
*
Mpack (Unix) mpack and munpack are utilities used to encode and decode binaries for use in mail messages following the MIME standard. It was originally written by John Gardiner Myers of Carnegie Mellon University in 1993, and has been ported to the classic M ...
* Webarchive *
Web ARChive The Web ARChive (WARC) archive format specifies a method for combining multiple digital resources into an aggregate archive file together with related information. The WARC format is a revision of the Internet Archive's ARC_IA File Format that ...


References


External links


MHTML standard explained
* RFC 2557 (1999)—MIME Encapsulation of Aggregate Documents, such as HTML (MHTML) * RFC 2110 (1997, Obsolete)—MIME E-mail Encapsulation of Aggregate Documents, such as HTML (MHTML) {{DEFAULTSORT:Mhtml Archive formats Internet Explorer HTML MIME Web Archives