15

I'm faced with situation when I need to edit a .mht file (for example: add some text to site).

Could you please suggest a way of editing .mht (web archive) files?

What I've tried:

  1. (editors like: notepad, word);

  2. I-Explorer add-ons (like HTML Quick edit Bar)

7 Answers 7

8

An MHTML file is a web page archive format. It is meant to be stored and viewed but not to be edited directly.

However, you can easily extract the MHTML file to a regular HTML document (with linked files), edit it with your favorite HTML editor and then export it back to an MHTML archive (including the linked files).

Since you're using Internet Explorer, note that you can open/save between HTML and MHTML files. This can effectively be used to unpack, edit and repack the MHTML archive. Google Chrome can do this as well.

You may also find software that are able to edit the MHTML file directly (doing the unpacking/repacking in the background). Microsoft Word seems to be able to do this, but depending on your document structure, it may impact the content layout.

4
  • 3
    I support this answer, since the idea behind the .mht is to have an archive. Archives are normaly meant to be stored eg. for backups and not to be modified frequently.
    – Zim84
    Commented Apr 26, 2013 at 13:39
  • 3
    +1 for "Internet Explorer can open/save between HTML and MHTML files" Commented May 26, 2014 at 0:07
  • 2
    Why the downvote ? Feel free to leave a comment, I'll gladly complete, update or correct this answer.
    – zakinster
    Commented Mar 27, 2018 at 6:23
  • This doesn't seem to work for more complex MHT files. all I got was a HTML page with a lot of proprietary XML tags and .TMP files... Commented Apr 16, 2021 at 5:49
4

A quick look at the wikipedia entry for MHTML shows that it's an archive format, a little bit like a zip or rar archive. In order to edit a .mht you will need to unpack it, edit the required file then repack the archive.

You don't say what platform/software you are using but if you do a websearch for ".mht unpacker" you should be able to find something to do the job.

3

Unpacking a .mht to a local folder, edit the code and re-save it to .mht won't work. If you save to .mht from a local drive none of the linked files (pictures and whatever else is used for the page other than included within the html file) will be stored in the container.

1
  • 2
    That's true if you're trying to save an internet page to MHTML (all linked resources will not be saved) but that's not OP's question. If you're starting with a working MHTML file (with all linked resources inside), you can effectively extract it to HTML (with additional files) and repack it without losing any resource. Tested with both IE and Chrome without issue.
    – zakinster
    Commented Feb 11, 2020 at 9:34
3

I used Word (office 365) to open modify and save the changes. Maybe is not a optimal solution but works.

2

WizBrother.com WizHtmlEditor is a super capable fast and light wysiwyg editor that is ideal for quick assembly of elements because it can accept almost anything you throw at it - an entire screen of formatted html including pictures, rtf, drag-n-drop from a browser, and from clipboard, even media files. It doesn't care if it's editing MHT or HTML or several other formats. It's free - and they have a bulk converter BTW. Do a search and see.

3
  • 1
    Actually it is awfully slow at loading and switching between Edit/Source tabs.
    – IVO GELOV
    Commented Dec 2, 2016 at 16:11
  • 1
    It is only for WIndows.
    – August
    Commented Mar 15, 2023 at 21:42
  • I, too, had trouble with Wiz being very slow. It would initially load my MHTML file fine and seemingly fast, but then it would hang up shortly after for long enough I decided to try other methods. Commented Jan 26 at 21:21
1

Notepad++ just now worked fine for me for what I wanted to edit directly in an MHT (and an MHTML). Just make sure not to save it back out as a .txt file. There was a box in the save as dialog to uncheck. This is using Notepad++ v8.6 64-bit Portable for Windows, and in my case I was editing some URLs to point to local files instead, for an archived copy of a defunct website.

-3

I just open and edit with Microsoft Word. This is actually the official approved way of doing it BTW.

3
  • 3
    "This is actually the official approved way" what is your source for this ? Microsoft Word tends to mess up HTML structure from my experience, unless of course your document was a word document in the first place but in this case, why would it be saved to MHTML ?
    – zakinster
    Commented Feb 11, 2020 at 9:20
  • 1
    Here is your clue MHTML: 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. Commented Feb 11, 2020 at 21:57
  • The first answer explained why MS Word is not optimal and this answer repeats the previous answer, except for the declaration that it is the "official approved way" without citing a source, saying in essence that it is the Microsoft approved way, which is hardly official. Your reply that they were first emphasizes that bias. Being first does not mean they own the standard, and even if they do or did, a citation would be useful before making a snide and condescending claim. Come to think of it, nothing actually supports being snide and condescending and not having citations makes it worse.
    – August
    Commented Mar 15, 2023 at 21:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.