Many years ago, the Mozilla Application Suite implemented support for a jar: protocol. This protocol states you can refer to ZIP-compressed files inside an archive served as
application/x-jar. A typical URL would look like
jar:https://alexvincent.us/somepath/target.jar!/test.html. The idea is that you download one file, target.jar in this case, and your browser extracts the rest of your files from that URL.
Today, Mozilla Firefox uses it as part of how they store their user interface (omni.jar these days) on the local file system.
With one major catch, though.
As far as I can tell, Mozilla Firefox is the only major browser to support the jar: protocol. This is not news. Even Google Chrome has not implemented support for the jar: protocol.
Naturally, Firefox’s history hasn’t been perfect with the jar: protocol. They did fix the one issue I found publicly available about it, and wrote about it on MDN. I’m not aware of any other issues, so theoretically they should be safe to use.
I’m thinking about using this capability on my website. For my “Visualizing the DOM” series I’m developing, I have a lot of JS files that I’m using, including some library files. Ogg Vorbis doesn’t compress so well (on a 9 minute audio I received a 1% benefit), so I won’t include that. Alas, if I lock out all the major browsers except Firefox, I’m not going to be too happy. The good news is that the HTML file which loads my “theater” application is PHP-generated – so based on the user agent, I can probably send the user a JAR archive (to Firefox users) or the uncompressed files directly.
Comments welcome! Particularly if you think this is a good or a bad idea.