PDA

View Full Version : browser caching



michael melsen
21 Dec 2010, 4:23 AM
Hi everyone,

during development we often notice that upon releasing a new build, the users browser still caches old components. Is it possible to force an update or let the browser know that it should drop the caching? after a refresh of the page with ctrl + f5 the caching will be destroyed but this can't be asked of the user ofcourse. Hope someone has an idea how to fix this.

kind regards,

Michael

Condor
21 Dec 2010, 5:07 AM
I have ETags enabled on my Apache server, so the browser automatically verifies it has the latest version of all files.

The only exception are .css files that are cached by IE, even though they have new ETags. For that I add a version number query string to my css url:

<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css?version=20101221" />

michael melsen
23 Dec 2010, 1:37 AM
Hi Condor,

thanks for your reply / information. I read also that turning on ETags can impact performance which is quit easy to understand as each file will be checked for age. Can you tell me what etags costed you performance-wise? Also would it help to add html meta tags like no-cache?

kind regards,

Michael

Condor
23 Dec 2010, 1:47 AM
Etags only have to be determined once for every new file. The performance impact for that isn't big.

Making your pages no-cache impacts performance much more, since it will always request the file again from the server.