[whatwg] Zip archives as first-class citizens

Mark Nottingham mnot at mnot.net
Wed Aug 28 18:14:18 PDT 2013

Hey Anne,

On 28/08/2013, at 11:32 PM, Anne van Kesteren <annevk at annevk.nl> wrote:
> * Fragments: fail to work well for URLs relative to a zip archive.
> Fragments are conceptually the cleanest as the only part of a URL
> that's supposed to depend on the Content-Type is the fragment.
> However, if you want to link to an ID inside an HTML resource you'd
> have to do #path=test.html&id=test which would require adding
> knowledge to the HTML resource that it is contained in a zip archive
> and have special processing based on that. And not just HTML, same
> goes for CSS or JavaScript.

I'm sure you've thought about this more than I have, but can you humour me and dig in a bit here? 

If I wanted to link *within* the HTML, it could still be <a href="#test">, correct?

Likewise, in the CSS if I wanted to define style for that id, it'd still be #test { ... }.

AIUI the case that's more of an issue is if I want to link from foo.html to bar.html#test, both inside the zip.

It seems to me that you need *some* idea of the structure of the zip inside there -- just as you need some idea of the structure of the Web site when linking between HTTP resources. The question to me is whether you can make it compatible with existing syntax to make it go down easier. 

E.g. if this would work: <a href="bar.html#test">

Couldn't that be done by saying that for URIs inside a ZIP file, the base URI is effectively an authority-less scheme? 

E.g., for "foo.html" the base uri would be "zip://foo.html". 

The zip URI scheme wouldn't be used in practice, just for rooting relative URIs inside of ZIP files. From the outside, the fragment identifier syntax for the zip format would dispatch appropriately, e.g.,


I *think* the end effect here would be that from the inside, HTML, CSS and JS wouldn't have to be changed to be zipped. From the outside, if you want to link *into* a zip file, you have to be aware of its structure, but that's really always going to be the case, isn't it?

Just a thought.


Mark Nottingham   http://www.mnot.net/

More information about the whatwg mailing list