gildas-lormeau/SingleFileZ

Make resources work after extraction

piegamesde opened this issue · 7 comments

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)

all resources are broken

What do you mean?

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)

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.

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.

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.

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?

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