Why does "save as .mhtml" not save my images? |
Why does "save as .mhtml" not save my images? |
giomach |
Jun 21 2024, 06:31 AM
Post
#1
|
Group: Members Posts: 4 Joined: 19-June 21 Member No.: 27,985 |
This is not really a markup question, but Chrome Help Community seems to be inaccessible. I don't think the problem is confined to Chrome anyway.
The simple webpage below contains a relative url to an image. When run on my local machine, the image appears correctly. But when I use Chrome to "save as .mhtml" the webpage, and then open the .mhtml in Chrome, the image is not found. On examining the .mhtml, I see: 1. the relative url has been changed to the absolute url from my local machine 2. the .mhtml appears to contain the image in base64 encoding Everything I read about saving to .mhtml tells me that it contains any images needed. Why is the image not found in my case? Here's the webpage. To test it, copy any image of your own and name it "leachtaban.jpg". CODE <html> <head> <meta http-equiv="Content-Type" content="text/html"; charset="utf-8"> <title>Why doesn't "Save as Webpage, Single File (*.mhtml)" include the image in the saved file?</title> </head> <body> <p>Here's an image.<br> It has a relative url.<br> It shows up when the page is opened in Chrome.<br> But when the webpage is saved as .mhtml and reopened in Chrome the image is not found.<br> In the source of the .mhtml, the relative url has been replaced by its absolute url on the local machine.<br> The .mhtml file contains what appears to be the image in base64 encoding. But it's not used.<br> Why does that happen? How do I prevent it?</p> <p><img src="leachtaban.jpg" alt="leachtaban" width="400" /></p> </body> </html> |
Christian J |
Jun 21 2024, 09:01 AM
Post
#2
|
. Group: WDG Moderators Posts: 9,722 Joined: 10-August 06 Member No.: 7 |
On examining the .mhtml, I see: 1. the relative url has been changed to the absolute url from my local machine Does the image file exist at that location? QUOTE The .mhtml file contains what appears to be the image in base64 encoding. But it's not used. So it's not part of the IMG element's SRC value? How is it stored in the .mhtml file then? |
pandy |
Jun 21 2024, 11:52 AM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,756 Joined: 9-August 06 Member No.: 6 |
As I recall MHTML never worked well with IE (the original implementer) back in the day. Haven't tried it since, but did now with Edge, saving https://htmlhelp.com/reference/ .
Viewing source of the MHTML file from Edge it looks totally normal. Same as viewing source of the real web page. When opening it in a text editor it also looks pretty normal with the addition of a MIME header and some odd huge Meta tag. The URL to the image files are changed from root relative URLs to full URLs to the files on the server. But the images still load when offline. Don't get it. Magic? HTML <h2><a href=3D"https://htmlhelp.com/"><img src=3D"https://htmlhelp.com/icon= /wdglogo.gif" width=3D"250" height=3D"74" border=3D"0" alt=3D"The Web Desig= n Group"></a></h2> That peculiar '3D' is added before each leading quotation mark. Don't know what that is either, looks like URL encoding gone wrong, but it can't be. HTML <div style=3D"float: right" class=3D"skyscraper"> So, while giomach's images don't work, mine work even though they shouldn't. |
pandy |
Jun 21 2024, 12:02 PM
Post
#4
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,756 Joined: 9-August 06 Member No.: 6 |
Ah, here the images are, at the very bottom.
CODE ------MultipartBoundary--jo7rM4e84HPKQazRhckiwg12STPtxcqw2qI6ibnF7x---- Content-Type: image/gif Content-Transfer-Encoding: base64 Content-Location: https://htmlhelp.com/icon/wdglogo.gif R0lGODlh+gBKAPf/AP///wgICBgYGCEhISkpKTExMTk5OUJCQkpKSlJSUlpaWmNjY2tra3Nzc3t7 e4SEhIyMjJSUlJycnKWlpa2trbW1tb29vcbGxt7e3ufn5+/v7/f3987Gxt7W1r21tca9vYyEhPfn 53Nra4R7e2NaWvfe3kpCQv/e3u/OzikhIZx7e+e1teetreecnN6EhNZ7e9Zzc9Zra85SUsY5Ob0x McYxMcYpKb0hIaUAANZaUs5SSs5KQsYxKcYhGOeUjN6MhOeMhN57c85jWtZjWu+tpeeclO+1rdZr Wt6Ec85KMe+llPe9rffe1vfGtf/n3vfOvf/v5//37///73OEeyFSQmOEe6WtrXuEhEJKSjE5OSkx MSlSUjFjYzlrczFja0qElGuEjDlSWilaa1qElEKEnDlzjN7v99bn75yttXOEjFqMpc7e587n94St xmOMpWucvXuctUJznDFae3uEjN7v/7XG1lpja0pjezFCUufv9621vc7e78bW58be96W91py1zrXW 96XG54SlxoSt1mOEpVp7nDlSazlae2OErVJznEprlEJjjEpzpTlahJSlva3G56W93pStz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E ER4KjBIZIDvsFWcgII5/0Ads0DDjfsEAYAbRsGHpyAaAcAw3XgljABSQNcdvMqQ3POv7uBuL3VAJ yV8H4eQEeMgDwXn1/5AXGxDgGyAFE4tF/eACNnM/pP8OALADOKNF72D+R0CSBAGxsX8SDzCeTjVZ +xEB0wAQ2P5EM8MHUrMNGwryyQMgT6hJqCo9GPGA4pWKVxw8cCAiS4INAESOBCDg30mUKf9BINnS gkqYBEKKxBAA5k2cKAMosNDSJ4AMDGzmJPqvwIWfJEPww6HPx5Mf+nDgE8kCR7yqOPgRceLj3j4N AH7geAGlSD8cLQC0w/GuCJQn+XAASVrXrsgJCRY42OgA48YHf69gHAHCGRo0juBMgiOpTRtczyiO 4Eu5r4MRGjeOYFAApE8JBUSPJr3ArgYEpFUfCDsyNGkCqlUjaBChwv8FcjPvJsVAAQGBoTcDFFhg QfdukShYtFjhhGQUFMeZEGmBoiUUI0o6QI8SpZ4LKSiYl0BefiQ5BAlE8OXogEFqAgQOKGiAWSNl ihYrtq/Yd4oIBhhYjz2+MGoAAQEQMG9BBht08EEII7TriR7UknC3CgzIgj4GDhBggAhGEucBAwhA YMDARqgoM4wMVEALAQQg4AEJEkhhgAIQWICBBhIALsQLgxRySCKLNNIuCwiIsYHWfqqgAPoy2yyz zBo4oAAJOkgqg7wGCCCAB44Uc0wyyzRzpCbt+uCABBrgSMqKRChRnDPrtPNOPPEU5wDa/KLSAQQC oCBPQgs19NAGOzgswAQG8nMggQBEQHRSSis9NIMDBoiPAC8NOM5SUEMVdVRSSzX1VFRTVRXCgAAA Ow== Some internal mumbo jumbo must replace the URL in the image tag with the Base64 image. |
pandy |
Jun 21 2024, 12:22 PM
Post
#5
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,756 Joined: 9-August 06 Member No.: 6 |
It seems it doesn't work with local pages.
I saved this CODE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>MHTML test</title> </head> <body> <div> <img src="images/sue_ellen.jpg"> </div> </body> </html> as MHTML and got this. CODE From: <Saved by Blink> Snapshot-Content-Location: file:///C:/Users/user/Desktop/TEST/mhtml.html Subject: MHTML test Date: Fri, 21 Jun 2024 19:10:16 +0200 MIME-Version: 1.0 Content-Type: multipart/related; type="text/html"; boundary="----MultipartBoundary--eWAm6fz8cbonCqRKmFRqEY9Tiofi2pBHzh9vf5t7FG----" ------MultipartBoundary--eWAm6fz8cbonCqRKmFRqEY9Tiofi2pBHzh9vf5t7FG---- Content-Type: text/html Content-ID: <frame-558C9B1A5CA7879B42901EF63ADD1F5E@mhtml.blink> Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/Users/user/Desktop/TEST/mhtml.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/htm= l4/strict.dtd"><html><head><meta http-equiv=3D"Content-Type" content=3D"tex= t/html; charset=3Dwindows-1252"> <title>MHTML test</title> </head> <body> <div> <img src=3D"file:///C:/Users/user/Desktop/TEST/images/sue_ellen.jpg"> </div> </body></html> ------MultipartBoundary--eWAm6fz8cbonCqRKmFRqEY9Tiofi2pBHzh9vf5t7FG---- Content-Type: image/jpeg Content-Transfer-Encoding: base64 Content-Location: file:///C:/Users/user/Desktop/TEST/images/sue_ellen.jpg /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcG BwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwM DAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCABkAGQDASIA AhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEB AQAAAAAAAAAAAAAAAAAAAAn/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCRgKoL WAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAP/Z ------MultipartBoundary--eWAm6fz8cbonCqRKmFRqEY9Tiofi2pBHzh9vf5t7FG------ But the image doesn't display. There's nothing wrong, neither with the URL nor with the Base64 encoded image. I pasted it into an ordinary HTML document and it worked fine. Must be some kind of restriction. Tried to google MHTML, local files, restrictions... no bananas. |
giomach |
Jun 21 2024, 05:54 PM
Post
#6
|
Group: Members Posts: 4 Joined: 19-June 21 Member No.: 27,985 |
It seems it doesn't work with local pages. ... Must be some kind of restriction. Tried to google MHTML, local files, restrictions... no bananas. Yes, thanks, that seems to be the restriction, see wikipedia — MHTML is “a Web archive 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.” (my emphasis) In a way it's easy to understand that, but given that the image is present in the .mhtml file, wouldn't it be reasonable to expect that a browser (or an extension) on finding a local url would convert the embedded base64 code and show the image? Instead of treating it as if it's not there. Probably some security vulnerability. Of course the webpage and its images will all go on the internet when it's finished, but while you're developing it on your local machine and you want to share it with someone who's not very computer-savvy, the restriction is a real nuisance. |
pandy |
Jun 21 2024, 10:23 PM
Post
#7
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,756 Joined: 9-August 06 Member No.: 6 |
Yes, but I don't think that needs to be interpreted as local URLs won't work. They talk about web pages and I think they want to point out that that full URL to the file on the web will be in the MHTML, but it's only representation (it will be swapped for the Base65 image).
There must be a reason for this. I don't know if maybe whatever part of the browser handles this maybe isn't allowed to read local files. On the other hand it reads the original HTML... Have you tried to put just the images on the web somewhere and link to them in the IMG tag? Have a feeling it would work then. But maybe too much work if you have many pages. Dumb me. I can try that myself. I swap my sue-ellen image for the WDG logo. Just a minute... Yup. That works. |
Lo-Fi Version | Time is now: 10th October 2024 - 01:14 PM |