assets cache Jahia 7.3 Jahia 8

CSS, JS assets behaviour in browser cache

Question

Is there a way to force the browser to reload assets when they are updated?

Answer

When using the addResources tag in your JSP, your JavaScript file is aggregated with others and a hash is added so that the browser will only cache the JS if it doesn't change.

The aggregation is only done in live mode. For edit mode and preview, you can use the property (in the jahia.properties file) addLastModifiedDateInAssets and set it true. This property will force Jahia to add the last update date in the file name.

This property is available since Jahia version 7.1.2.1