[whatwg] Image cache behaviour

Ian Hickson ian at hixie.ch
Mon Jun 11 14:48:18 PDT 2012

On Wed, 21 Mar 2012, Andrew Oakley wrote:
> I've noticed that some browsers (Firefox, Opera, IE) cache images 
> without following the HTTP expiry rules.  This does not appear to be 
> permitted by the HTML5 specification.
> I've got a test case for this (with explanation) here: 
> http://ado.is-a-geek.net/expired/tests/image_cache_test.html
> Boris Zbarsky believes this behaviour is required for compatibility so I 
> think it is worth adding to HTML5.  This was discussed on the Mozilla 
> bug tracker here: https://bugzilla.mozilla.org/show_bug.cgi?id=295942
> How do other browsers handle this?  It seems to be possible to get Opera 
> and IE to throw the image away by changing the src attribute on the img.
> Are there similar caches for any other type of object or is this just 
> images?

For images in <img> elements I've now explicitly added spec-level support 
for such a cache. Not my favourite part of the spec, but if it's what 
implementors do interoperably...

The spec is a bit vague, let me know if there's anything I can do to 
tighten it up while still being compatible with what UAs will implement.


On Wed, 21 Mar 2012, Boris Zbarsky wrote:
> Gecko has a similar (different in mechanism, but not too different in 
> effect) cache for stylesheets.  I seem to recall that there was explicit 
> text about this as well, but I can't find it now.  The closest I can 
> locate at the moment is the first paragraph at 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/fetching-resources.html#fetch 
>   If the resource is identified by an absolute URL, and the resource
>   is to be obtained using an idempotent action (such as an HTTP GET
>   or equivalent), and it is already being downloaded for other reasons
>   (e.g. another invocation of this algorithm), and this request would
>   be identical to the previous one (e.g. same Accept and Origin
>   headers), and the user agent is configured such that it is to reuse
>   the data from the existing download instead of initiating a new one,
>   then use the results of the existing download instead of starting a
>   new one.

Right now I haven't specced anything like this. Ideally I'd like to move 
all the CSS logic out of the HTML spec, since e.g.I assume that any 
caching for <link rel=styleseet> would also need to happen for @import.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list