I’ve long experienced serious browser caching problems with CSS files generated by Freeway. The scenario goes like this. I make a change in Freeway, then upload, then check in Safari (reading files off my web server, not Freeway preview), and I find the the pages are messed up. So I click reload in Safari (tiny round circular icon to the right of the address bar), but sometimes that doesn’t load the new CSS file and just shows the cached version. So I then press the Option key and then click reload in Safari again, and then Safari will usually display the new CSS file from off my web server and the page displays perfectly.
The problem is that I know how to press Option and click reload to make the page look right. And when that doesn’t even work, I know to relaunch Safari to make it work. But the rest of the planet does not know those tricks, nor do they want to fuss with them. So until my newly upload CSS file gets cached by the browser, everyone who frequents my websites will see the page as broken or strange. I am sick and tired of this, hence my post here today.
What I’ve tried to do to remedy the problem is modify my .htaccess file with the following cache control code:
# Assign 3-month Browser Cache storage for these static assets:
<FilesMatch ".(ico|pdf|zip)$">
Header set Cache-Control "max-age=7257600, public"
</FilesMatch>
# Assign 2-week Browser Cache storage for these static assets:
<FilesMatch ".(jpg|jpeg|png|gif|js)$">
Header set Cache-Control "max-age=1209600, public"
</FilesMatch>
# Assign 18-hour Browser Cache storage for CSS:
<FilesMatch ".(css)$">
Header set Cache-Control "max-age=64800, public"
</FilesMatch>
And as you can see, the shortest cache duration is assigned to CSS. But even 18 hours isn’t short enough. I’ve tried to prevent caching too, but that isn’t a perfect solution.
What I really need Freeway to do for me is generate “versioned” CSS code like this:
<link rel="stylesheet" type="text/css" href="styles.css?version=26">
Alternatively, Freeway could just change the name of the CSS file every time, as that would solve the problem too.
Has anyone created an Action that accomplishes this automatically?
Thanks,
James Wages
freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options