Lode
unread,Apr 29, 2013, 5:23:13 AM4/29/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to chromium...@chromium.org
Hello,
For a game written in JavaScript, for the images of that game, I used a PNG image that contains all the textures. By setting background-position, the right texture is chosen. The image itself is set with background-image: "url(image.png)". (Note: the background-position thing is irrelevant to the problem below, just mentioning it to show that it's a single image being requested many times).
When rendering the game board on screen, in JavaScript, it adds all the tiles with the image above (as divs with a CSS class containing that background-image) to the DOM.
So here is the thing:
When rendering e.g. 100 such tiles on screen in one go, Chromium will send 100 requests to the server for image.png. This makes it of course ugly and flickering, plus sends too much requests to the server (it sends back lots of 304 Not Modified).
Firefox does not, Firefox sends the request only once, and then never anymore, and has no flickering.
The solution for making it work properly in Chromium too, is to add a cache-control HTTP header to the image. Then it does the same as Firefox already does without that header.
Questions:
1) Why does Chromium do this? Is Chromium or Firefox behaviour more correct according to the relevant standards?
2) Are there any other solutions than a HTTP header, because, what if you cannot control the HTTP headers of the server you host your files on?
3) Is this a bug, or intended behaviour?
Thanks.