Old style.css in browser cache after new application version.

Hi guys,

We have the following problem: after we redeployed the last version of BlackBeltFactory.com (as yesterday), people don’t see the layout right because they have an old style.css in their browser cache. They need to press ctrl+F5 to relaod the last version the get the layout right (try on the home page now for example).

In a classic web site, I’d add a fake parameter in the reference to the stylesheet. Something like:

<link rel="stylesheet" type="text/css" href="/VAADIN/themes/blackbelt/styles.css?v3.5.17">

That fake parameter would be the application version number, for example.

With the Vaadin application, my problem is that I don’t have any influence on that generated link, do I?

John.

Hi John,

We fought with this issue ourselves every time we published a new version of Vaadin: Sampler would always end up looking funny with someone since the styles were cached.

The issue is documented in the ticket
#2586
. There’s talk about your proposed solution as well, which unfortunately does not work across all browsers.

So if you’re serving the styles through the Vaadin servlet, this issue should be fixed. If not, then it’s an issue in your own server than serves static files.

Thanks Jouni.

If the parameter trick is not doable because of Safari and Opera, what about changing the name?

<link rel="stylesheet" type="text/css" href="/VAADIN/themes/blackbelt/v3.5.17/styles.css">

This would work only if we serve through the servlet (the v3.5.17 subdirectory would not really exist).

While writing this, I figure out that I could rename the “blackbelt” theme directory manually after a major version.
blackbelt2, blackbelt3,…

John.

Hmm… We though about something similar, but decided against it because of general theme inheritance (custom themes declaring @import and referencing e.g. reindeer/styles.css. But I guess those situations could be handled by the servlet as well…

But to rephrase, the issue is fixed in Vaadin 6.3.0, if you’re serving the VAADIN-folder through the Vaadin servlet. If you’re experiencing problems, I suggest you re-open the ticket and provide us with a test case.

If you’re using a regular HTTP server to serve the static files, just make sure you’re attaching proper cache headers for the CSS and image files.