?
avatar ggppdk
ggppdk
20 Oct 2015

When you upgrade Joomla and some JS / CSS file have been updated

  • any users browsing the website, backend of frontend, will get the old versions of the files from the browser cache.

Is there a reason that we do not append to the URLs:
?v=somehashvalue

There have been several invalid reports here, because of browser cache serving older JS / CSS files after Joomla is upgraded

avatar ggppdk ggppdk - open - 20 Oct 2015
avatar mbabker
mbabker - comment - 21 Oct 2015

1) We should not use the CMS version number as that string ever.

2) We have at least 2 APIs that are supposed to be doing this that depend
on different things being set up correctly (and ironically I'm pretty sure
neither are used right).

On Tuesday, October 20, 2015, Georgios Papadakis notifications@github.com
wrote:

When you upgrade Joomla and some JS / CSS file have been updated

  • any users browsing the website, backend of frontend, will get the old versions of the files from the browser cache.

Is there a reason that we do not append to the URLs:
?v=Joomla_Version

There have been several invalid reports here, because of browser cache
serving older JS / CSS files after Joomla is upgraded


Reply to this email directly or view it on GitHub
#8118.

avatar ggppdk
ggppdk - comment - 21 Oct 2015

I see about Joomla CMS version number

Then we could append a hash value that is calculated on

  • on Joomla version
  • and on or a per site string (e.g site domain)

?v=hashValue

avatar mbabker
mbabker - comment - 21 Oct 2015

Like I said, we already have two APIs which is supposed to support this:

JDocument::addScriptVersion() and JDocument::addStyleSheetVersion() within the JDocument API

JHtml::includeRelativeFiles() within the JHtml API (called via JHtml::script(), JHtml::stylesheet(), and JHtml::image())

If neither of those APIs are working, fix them. Don't add another way to do it. Please. We have too many duplicated APIs like this already.

avatar ggppdk
ggppdk - comment - 21 Oct 2015

sorry, i did not mean that they do not work,

i was asking why they are not used by Joomla CMS by default

avatar zero-24 zero-24 - change - 21 Oct 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 21 Oct 2015
Category Templates (admin) Templates (site)
avatar Devportobello
Devportobello - comment - 21 Oct 2015

Actually JHtml::script() JHtml::stylesheet() JHtml::image() dont allow to use query string in the $file arg :/

avatar zero-24
zero-24 - comment - 21 Oct 2015

I guess @mbabker means this: https://github.com/joomla/joomla-cms/blob/3.4.4/libraries/cms/html/html.php#L362-L496 with a MD5SUM file not adding a query string ;)

avatar mbabker
mbabker - comment - 21 Oct 2015

Exactly that. If there is a file named MD5SUM in the folder where the resource being called via the JHtml helpers resides at, the contents of that file (which should be a calculated hash based on the contents of the directory and changed anytime something in that directory changes) will be appended as the query string.

As for why they are not used by default, why does every media file require a query string by default?

avatar demis-palma
demis-palma - comment - 3 Nov 2015

why does every media file require a query string by default?

Actually @ggppdk answered to this question in advance:

When you upgrade Joomla and some JS / CSS file have been updated
any users [...] will get the old versions of the files from the browser cache.

In my opinion, the query string should contain by default the timestamp of the resource.
For the cache purpose, it is equivalent to an hash, but it is faster than calculating an hash.

avatar piotr-cz
piotr-cz - comment - 5 Nov 2015

If anyone is looking on information how to use the MDSUM file:
put such file in the assets folder and inside a md5 checksum of all assets contents.

avatar ggppdk
ggppdk - comment - 18 Dec 2015

About default behaviour

Using a string based on file's modification or creation time

  • will not give out any info,
  • will cost almost nothing in time, since file will be read anyway by the server,
  • while it will avoid stale CSS / JS after upgrades that this topic is about

and also all proxies since - 5 years versions support query strings in the CSS / JS resources URLs

avatar brianteeman
brianteeman - comment - 18 Dec 2015

The code to do this was created a long time ago #1618 if i am correct

On 18 December 2015 at 20:20, Georgios Papadakis notifications@github.com
wrote:

About default behaviour

Using a string based on file's modification or creation time

  • will not give out any info,
  • will cost almost nothing in time, since file will be read anyway by the server,
  • while it will avoid stale CSS / JS after upgrades that this topic is about

and also all proxies since - 5 years versions support query strings in the
CSS / JS resources URLs


Reply to this email directly or view it on GitHub
#8118 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar ggppdk ggppdk - change - 19 Dec 2015
Title
Why URLs of CSS / JS files do not have a version variable appended to their URLs to bypass browser cache after upgrade
Why URLs of CSS / JS files do not have a version/hash variable appended to their URLs to bypass browser cache after upgrade
avatar brianteeman
brianteeman - comment - 28 Jan 2016

Checking 3.5beta 2 I see that both template.css and template.js have a version type parameter


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8118.

avatar brianteeman brianteeman - change - 19 Feb 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-02-19 12:59:10
Closed_By brianteeman
avatar brianteeman brianteeman - close - 19 Feb 2016

Add a Comment

Login with GitHub to post a comment