If you're looking for a way of bundling resource requests for arbitrary file types into single HTTP request, there is already a feature in the HTTP 1.1 that allows you to do this; it's called HTTP Pipelining [http://en.wikipedia.org/wiki/HTTP_pipelining]. Unfortunately this feature is off by default in Firefox, but you can override it to be on using about:config.
Other browsers don't yet support it, but they don't support archives yet either. As it stands, CSS Sprites are really the only cross-browser compatible option we have, and we're going to have to make do with them.
I like your idea, but it appears to me that this is better implemented on the HTTP layer.
Pipelining reuses a single TCP connection, but still makes multiple HTTP requests. This means that you still send and receive a bunch of mostly-duplicated request/response headers, and still have the latency of multiple request/response round trips.
Archives/sprites/etc. are better in some ways than pipelined requests. Consider the case where the client is making a conditional GET request and the content hasn't changed on the server. If the content is bundled into a single resource, then you just have a single request and a single HTTP 304 response with no body. But if the content is served as multiple resources, then you have the exact same conversation repeated once for each resource. For a site with 100 images, this will use 100x the bandwidth and take nearly 100 times as long.
Does anyone have any further information on this? It's interesting to see that while most modern web servers handle this, most web clients do not or disable it be default.
If this offers nothing other than a performance increase, where is the issue?
Assuming the HTML is compressed, wouldn't this also achieve the same "poor-man's pipelining" result, as in less server connections? It seems to have broader browser support than the JAR thing.
Data uri's can't be cached, so they can only help latency of a cold page load, but they make every page after that slower. (if you put the data uri in your html instead of the css)
What would be nice is a script that extracts the image urls from the stylesheet(s), creates the sprite image for the used images, then creates another css file with the required offsets for the classes.
I have been putting off spending some time creating a script like this, mostly because I am pretty sure there is already one out there that does it.
Google Web Toolkit does this; I'm sure other web development frameworks do as well. A quick search for a standalone utility revealed: http://spritegen.website-performance.org/
.
CSS sprites are stupid. So stupid, in fact, that I refuse to use them. It wouldn't be such a big deal, I suppose, if IE6 supported proper transparency. But as it stands, I still cannot, in 2009, safely use a 24-bit PNG for my CSS sprites.
If anything like this is ever standardized, which seems unlikely, and implemented in all the major browsers, which seems even more unlikely, MAYBE in 30 years we can use it in production.
But as far as fantasies go, it's one of the cooler ones!
If you are thinking of local directory traversal (src="jar:http://kaioa.com/b/0907/test.jar!../../somefile) then I think you are underestimating browser coders. Introducing that security issue would require a dedicated effort.
[+] [-] mustpax|16 years ago|reply
Other browsers don't yet support it, but they don't support archives yet either. As it stands, CSS Sprites are really the only cross-browser compatible option we have, and we're going to have to make do with them.
I like your idea, but it appears to me that this is better implemented on the HTTP layer.
[+] [-] mbrubeck|16 years ago|reply
Archives/sprites/etc. are better in some ways than pipelined requests. Consider the case where the client is making a conditional GET request and the content hasn't changed on the server. If the content is bundled into a single resource, then you just have a single request and a single HTTP 304 response with no body. But if the content is served as multiple resources, then you have the exact same conversation repeated once for each resource. For a site with 100 images, this will use 100x the bandwidth and take nearly 100 times as long.
[+] [-] Batsu|16 years ago|reply
If this offers nothing other than a performance increase, where is the issue?
[+] [-] sayrer|16 years ago|reply
[+] [-] TweedHeads|16 years ago|reply
Color me surprised.
[+] [-] Barnabas|16 years ago|reply
Assuming the HTML is compressed, wouldn't this also achieve the same "poor-man's pipelining" result, as in less server connections? It seems to have broader browser support than the JAR thing.
Edit: I found this too... the MHTML method linked in this article is also interesting: http://danielmclaren.net/2008/03/embedding-base64-image-data...
[+] [-] tedunangst|16 years ago|reply
[+] [-] riso|16 years ago|reply
I have been putting off spending some time creating a script like this, mostly because I am pretty sure there is already one out there that does it.
[+] [-] dpifke|16 years ago|reply
[+] [-] tdavis|16 years ago|reply
If anything like this is ever standardized, which seems unlikely, and implemented in all the major browsers, which seems even more unlikely, MAYBE in 30 years we can use it in production.
But as far as fantasies go, it's one of the cooler ones!
[+] [-] andreyf|16 years ago|reply
[+] [-] blasdel|16 years ago|reply
[+] [-] pjhyett|16 years ago|reply
edit: I suppose I could have read the article first
[+] [-] pkulak|16 years ago|reply
[+] [-] stcredzero|16 years ago|reply
[+] [-] hello_moto|16 years ago|reply
http://code.google.com/p/google-web-toolkit/wiki/ImageBundle...
[+] [-] there|16 years ago|reply
[+] [-] fno|16 years ago|reply
[+] [-] noss|16 years ago|reply
Ok so IE6 and IE7 doesnt support it... never experienced that before.
[+] [-] lhorie|16 years ago|reply
[+] [-] gferd|16 years ago|reply
[+] [-] Semiapies|16 years ago|reply
[+] [-] TweedHeads|16 years ago|reply
In the future, when network speed is not an issue, we should be able to send the whole web app (or page) in one packet.
One request, one response.
[+] [-] roc|16 years ago|reply
[+] [-] achmed|16 years ago|reply
it is not the case that a faster network implies larger packets
[+] [-] erlanger|16 years ago|reply
[+] [-] erlanger|16 years ago|reply