24

How can I open an .mht file in linux (Ubuntu)?

1
  • 1
    Drag and drop to chrome works.
    – tgkprog
    Commented Mar 29, 2018 at 11:10

8 Answers 8

14

.mht stands for MHTML (MIME HTML). Internet Explorer uses this to save a web page and dependent files into one file.

To open these in Ubuntu, you need a special program. The Wikipedia entry lists a few:

Mozilla Firefox needs UnMHT or Mozilla Archive Format extensions to open and write MHT files. These add-ons work with Firefox 1.0 and later. Since version 5.0.0, UnMHT offers partial support for MHT files exported from Microsoft Office applications. Mozilla Archive Format, as well as opening and saving .mht files, also can save to its own "MAFF" format. The MHT files it generates are not fully compatible with Microsoft's products.[3]

Currently Firefox doesn't include support for saving or opening web pages as MHTML files without either of these add-ons, as of version 3.5.2. There is, however, source code available for viewing MHTML files within the related Thunderbird project, so in the future it may become available without such add-ons. This is filed as an unsolved issue within the Firefox project since 1999 (see bug 18764) though progress in fixing it seems to have stalled.

UnMHT is available here.

5
  • 1
    Direct link to addon: addons.mozilla.org/en-US/firefox/addon/unmht .
    – joshas
    Commented Oct 2, 2014 at 18:31
  • 1
    UnMHT seemed not to work to open MHT file generated by PSR.exe on a windows 7 rig (No Images, lots of inline XML shown) :( Commented Mar 17, 2016 at 21:11
  • Opens in chrome
    – tgkprog
    Commented Mar 29, 2018 at 11:09
  • 1
    Cheers from 2020. UnMHT is now dead :( Commented Jul 8, 2020 at 17:13
  • 1
    @AramParonikyan On Linux, I just unpacked a .mht (20211116.mht) produced by OneNote by (careful you might suppress | sh to proofread it): munpack 20211116.mht ; grep 'Content-Location: file://' 20211116.mht | sed 's_^Content-Location:\s*file:///\(.*\)/[^/]*$_mkdir -p \1 _g' | uniq | sh ; grep 'Content-Location: file://' 20211116.mht | sed -e '1d' -e '$d' -e 's/.$//' | cat -n | sed 's:^\s*\([0-9][0-9]*\)\s*Content-Location\:\s*file\:///:mv part\1 :g' | sh ; grep 'Content-Location: file://' 20211116.mht | head -n 1 | sed -e 's:Content-Location\:\s*file\:///:mv part1.desc :g' -e 's/.$//' | sh Commented Nov 17, 2021 at 21:04
10

Google Chrome can open MHTML, I checked.

5
  • it does, however i don't get the images Commented Aug 26, 2019 at 21:47
  • Yeah, it does if you drag the .mhtml file from the files app to the Chrome app. But if you just double click on it, it says "There is no application installed for "MHTML web archive" files. Do you want to search for an application to open this file?" If you say yes, it offers to install Falkon or GNOME Web, but gives no option to associate it with Chrome. How do you get it to just automatically open in Chrome?
    – Tyler Rick
    Commented Sep 18, 2019 at 19:16
  • One way to get it to open in Chrome is to right click, select "Open with Other Application", click "View All Applications", then select Chrome (or Chromium, etc.). It remembered my choice, so now I can simply double click on an .mhtml file and it will open it in the same app.
    – Tyler Rick
    Commented Sep 18, 2019 at 19:18
  • :-( chrome doesnt open mht as of today
    – JLuc
    Commented Dec 13, 2020 at 9:17
  • Not on Feb 2021, on Ubuntu 20.04 LTS (Chrome Version 88.0.4324.150 (Official Build) (64-bit)). I checked.
    – ntg
    Commented Feb 24, 2021 at 12:12
4

Simply install Opera and it handles it without requring any plugin. But of course, Opera is not really fashionable these days.

2
  • I had to save each image manually, but they did appear to be full resolution. Saving the page as a web archive seemed to just not work, but viewing the mht worked just fine. Commented Mar 17, 2016 at 21:28
  • This was the fastest solution. Firefox Quantum doesn't like the addon provided by @sleske Commented Jul 20, 2018 at 18:19
2

If you want .mhtml files to just automatically open in Chrome if you double click on them:

  • right click on the file
  • select "Open with Other Application"
  • click "View All Applications"
  • then select Chrome (or Chromium, etc.) and click the Select button

It remembered my choice, so now I can simply double click on an .mhtml file and it will open it in the same app.

2

Both the suggested Firefox browser extensions are dead (UnMHT and Mozilla Archive Formats). But other browsers based on Chromium engine can still open MHT files. I did it with Vivaldi browser.

1
  • i tried with Opera and Vivaldi and both failed to open mht. So the question is still open : how can .mht files be opened ?
    – JLuc
    Commented Dec 13, 2020 at 9:46
0

Chrome can open it, you just need to drap the file to chrome window or open it with chrome!

Enjoy!

0

I used GHex; found the URL in the beginning, and then my Ubuntu 20.04 standard web browser opened it with Internet connection.

0

Chrome wouldn’t render embedded images for me.

You can extract it using python-unmht and then open/view the extracted files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .