This article needs additional citations for verification .(April 2014) |
Filename extension | .mht, .mhtml |
---|---|
Internet media type |
|
Type of format | Markup language |
Extended from | HTML |
Standard | RFC 2557 (proposed 1999) |
MHTML, an initialism of "MIME encapsulation of aggregate HTML documents", is a web archiving file format used to combine, in a single computer file, 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 messages, using the MIME content type multipart/related
. [1] MHTML files use an .mhtml
or .mht
filename extension.
The first part of the file is an e-mail header. The second part is normally HTML code. Subsequent parts are additional resources identified by their original uniform resource locators (URLs) and encoded in base64 binary-to-text encoding. MHTML was proposed as an open standard, then circulated in a revised edition in 1999 as RFC 2557.
The .mhtml
and .eml
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 message can be saved using a .mhtml
or .mht
filename extension and then opened for display in a web browser or for editing other programs, including word processors and text editors.
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:<SavedbyBlink> Snapshot-Content-Location:https://en.wikipedia.org/wiki/Smartphone Subject:Smartphone-Wikipedia Date:Sat, 24 Sep 2022 00:34:32 -0000MIME-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/htmlContent-ID:<frame-D968CEC8BB7E60A1859261A8CA5DFB4D@mhtml.blink>Content-Transfer-Encoding:binaryContent-Location:https://en.wikipedia.org/wiki/Smartphone <!DOCTYPE html>
The MHTML file ends with a boundary string that is not followed by any data. [2]
MIME type for MHTML is not well agreed upon. Used MIME types include:
multipart/related
application/x-mimearchive
message/rfc822
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.
opera://flags#save-page-as-mhtml
" at the address bar.vivaldi://flags/#save-page-as-mhtml
" option.mhtconv
, can be used to allow saving and viewing of MHTML files.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. [7] The delivery method would be by spam emails. [8]
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. [9]
The data URI scheme offers an alternative for including separate elements such as images, style-sheets and scripts in-line when serving an HTML request or saving an HTML resource for offline use. Like the embedded content within MHTML, data URIs use Base64 encoding of the external resources (which may be binary or text) to embed them in-line within the HTML markup. HTML pages saved with external elements embedded using the data URI scheme are standard web pages, and can be opened by any modern browser, including browsers not supporting MHTML such as Mozilla Firefox. [10] Unlike MHTML, saving web pages with their external resources embedded using data URIs requires a third-party extension to be installed in the browser. [11]
The Mozilla Archive Format (MAFF) is a legacy Web archive file format that was supported by Firefox from 2004 to 2018 through an add-on. [12] Unlike both MHTML and data URIs, MAFF uses a ZIP container to preserve both the HTML file and its external elements. In October 2017 the add-on developer announced the format would no longer be supported in future versions of Firefox. [13]
{{cite web}}
: CS1 maint: numeric names: authors list (link)