Cache Cleaner

CSS + JavaScript browser cache

9 months 4 weeks ago #73643

Toni56's Avatar Toni56

Cache Cleaner is an awesome tool when you need to clear any server-side cache. But there are scenarios when you should 'clear' user's browser cache too. When you change something in your CSS/JavaScript files some users need to clear their browser cache or use CTR+F5/CTRL-SHIFT-R to check what you changed. Sometimes I bypass this problem adding a random url parameter after the CSS/JS files whicI changed. I was wondering if cache cleaner could do that, like from

<link href="/templates/mytemplate/css/template.css" rel="stylesheet" type="text/css" />
to
<link href="/templates/mytemplate/css/template.css?rev=20170724120505" rel="stylesheet" type="text/css" />
or time() of the last cleaning or the last modification of the file or any other parameter.
It could force reloading the file.
What do you think about that?

9 months 3 weeks ago #73647

Peter van Westen's Avatar Peter van Westen Admin

No, this is outside the scope of Cache Cleaner.

Joomla already has an option to load versioned stylesheets and scripts.
There are also other way to solve this (adding the query id to the string) like via ReReplacer or CDN for Joomla! (= Yes, you can 'mis'-use it to add versioning numbers to media files).

9 months 3 weeks ago #73656

Toni56's Avatar Toni56

That's true, I can accept your point.
I just tought cache cleaner could solve the simple case where
- I change something in the CSS
- The customer doesn't see any change
- I click on 'clean cache'
- voilà
But you're right, there are other solutions too, I just wrote a simple system plugin to do that :)