14

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)

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
slisnychyi
  • 1,832
  • 3
  • 25
  • 32

6 Answers6

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.

zakinster
  • 10,508
  • 1
  • 41
  • 52
  • 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 Apr 26 '13 at 13:39
  • 3
    +1 for "Internet Explorer can open/save between HTML and MHTML files" – Samuel Neff May 26 '14 at 00:07
  • 1
    Why the downvote ? Feel free to leave a comment, I'll gladly complete, update or correct this answer. – zakinster Mar 27 '18 at 06: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... – Christoph B Apr 16 '21 at 05: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.

Djimmr
  • 74
  • 5
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.

look
  • 39
  • 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 Feb 11 '20 at 09:34
3

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

freedeveloper
  • 3,670
  • 34
  • 39
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

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

Tom Stickel
  • 19,633
  • 6
  • 111
  • 113
  • 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 Feb 11 '20 at 09: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. – Tom Stickel Feb 11 '20 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 Mar 15 '23 at 21:49