Skip to content

Instantly share code, notes, and snippets.

@annevk
Created August 7, 2013 13:38
Show Gist options
  • Save annevk/6174119 to your computer and use it in GitHub Desktop.
Save annevk/6174119 to your computer and use it in GitHub Desktop.
zip URLs

Overview

There's an idea floating around of introducing a zip URL for resources. The general structure would be:

zip:{URL-to-zip}!{relative-URL-inside-zip}

Lack of ! is a parsing failure.

The zip URL works by (URL) parsing everything between zip: and ! against a base URL (if any).

Examples

zip:/e.zip!e.html
zip:http://example.org/e.zip!e.html

Issues with base URL

Where I run into problems is identifying the URL of the resource. Say you have the following on http://example.org/:

<iframe src=zip:/e.zip!e.html>

What will <iframe>.contentWindow.location return? If e.html contains a relative URL, where should that resolve to? What if it's a path-absolute URL?

Issues with origin

Even for simple cases such as <img src=zip:/i!pony.gif> we'd need to define the origin in a special cased manner.

Issues with URL API

The way URLs are supported today zip URLs would end up like a data URL and not have useful properties in the URL API.

Potential solutions

We could offer generalized support for URL schemes that support other URLs inside of them. E.g. view-source seems to also require this. However that would be an even more fundamental change to the overall URL landscape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment