Magento Website Changes Not affected on browser without clearing the Browser Cache

Viewed 44

We have created one website in Magento, Every time we change on CSS, HTML or Creating New Pages or changes in the CMS pages that is not affected on the browser without clearing the cache of the browser. Every time we cant say to client clear the browser cache and check.

So give me suggestion to how to resolve this issue.

1 Answers

With Css/Js Merging

The most simple way is using built-in css/js Merging. Simply enable merging under System->Configuration->ADVANCED (Developer). Each time your clear the js/css cache in magento it will generate new files with different names. This way client browser will always show updated content.

however magento merging has it limits and not always work if your css/js is very complex...

Without Css/Js Merging (complex integrtion)

There is one trick you can implement for continuous deployment strategy:

always append a random query string parameter to changed css or js path.

here is an example for page.xml layout in magento

<action method="addCss"><stylesheet>css/styles.css?12345</stylesheet></action>

you can automatize it with jenkins, gruntjs or bash-script whatever your deployment or code management strategy is.

Related