gildas-lormeau / SingleFileZ

Web Extension to save a faithful copy of an entire web page in a self-extracting ZIP file
GNU Affero General Public License v3.0
1.82k stars 140 forks source link

Make resources work after extraction #141

Closed piegamesde closed 1 year ago

piegamesde commented 1 year ago

I really like the concept of having all resources bundled in a zip file, as opposed to having to embed them as base64 in the html. However, it's a bit unfortunate that the extracted output only works as zip file: when extracting the contents and opening it, all resources are broken. It'd be cool to have both. The idea is that JavaScript is only required for the single-file, and one still has a fully static archive if needed.

I don't know much about how this works internally, but for me it'd be fine if the zip archive contained a separate index_archive.html that does this job instead of having everything within a single index.html. (Or maybe swap the names, and have index_singlefile.html instead)

(Related to #102 and #119)

gildas-lormeau commented 1 year ago

all resources are broken

What do you mean?

piegamesde commented 1 year ago

Downloaded page with SingleFileZ:

image

Renamed the file to .zip, extracted it into a folder and opening its index.html:

image

(the GitHub logo you can see on the second image only works because it is a html-embedded SVG in the first place, so no external resource)

gildas-lormeau commented 1 year ago

It's a limitation of the browser because you're opening the page from the filesystem. If you use an HTTP server, resources will be displayed as expected.

piegamesde commented 1 year ago

Oh, indeed. I'm sorry for the confusion then, I thought this limitation only applied to the single-file archive and not to the extracted contents.

gildas-lormeau commented 1 year ago

Note that it used to work in the past, but vendors make the use of the filesystem less and less convenient, probably for security reasons.

piegamesde commented 1 year ago

I see. Then the best thing we can do is to warn users about this better, not sure how though. Maybe add a README to the archive that hints at miniserve or something like that?

gildas-lormeau commented 1 year ago

I agree, I'll try to document this issue. I'll need to test it in all major browsers first.