RE: Clearing browser cache

pratik parekh, modified 7 Years ago. New Member Posts: 18 Join Date: 9/9/14 Recent Posts
I am having one liferay production server live.
For next release we have changed some javascript files.
Liferay minifies js and css files which are also cached in browser.
After next deployment users have to clear browser cache to see updated changes.

Is there any way I can forcefully clear browser cache?

We can apply release version while loading js and css file as suggested here.
But I am not sure how can I achieve this kind of solution for js files in portlet and for js file in theme.

If anyone has achieved same with this or some other way, please help me to achieve the same.

Thanks,
Pratik Parekh
thumbnail
David H Nebinger, modified 7 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
You don't have to worry about it.

Liferay stamps all static urls w/ an extra argument, t. You'll see this on every static URL the portal generates. When you view source on the page, you'll see that, for example, main.css is pulled in but there's an additional argument like &t=1341589290000.

This is the "time" for the last modified on the file on the server side. When you push a new file, that &t will change in the URL. Since the browser is caching based on URL matching, the new URL w/ the new timestamp will not match and the browser will fetch it again because it is a cache miss.
thumbnail
Olaf Kock, modified 7 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
David H Nebinger:
You don't have to worry about it.

...unless you've changed the files directly on the server. Then worry about it, and change the files properly by deploying an updated theme. Doing this means, you don't have to worry about it any more.
thumbnail
David H Nebinger, modified 7 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Olaf Kock:
David H Nebinger:
You don't have to worry about it.

...unless you've changed the files directly on the server. Then worry about it, and change the files properly by deploying an updated theme. Doing this means, you don't have to worry about it any more.


Yes, Olaf is right, I shouldn't have assumed that you do things the way liferay documentation, training, etc. all clearly state how updates are to be deployed.

But then again, if you don't do things the right way, I really believe that any backfire that results of it is due to asking for it...
thumbnail
Vishal Srivastava, modified 6 Years ago. Junior Member Posts: 26 Join Date: 7/7/14 Recent Posts
Hi All,Need some help for browser cache issue.I using Liferay 7.0 with Angular 4, when i am creating a Jar and deploying it on Production. Changes on the UI is not getting reflected until i go and clean the browser cache.Do we have any mechanism where browser cache get automatically cleared while deploying the JARS.Currently i have raised a help ticket for the same but still no luck.On my portal-ext.properties i have added:browser.cache.disabled=true
Thanks,Vishal Srivastava
thumbnail
Alfonso Crisci, modified 6 Years ago. Regular Member Posts: 136 Join Date: 4/2/14 Recent Posts
<p>I had this same issue and solved it by building the plugin with e.g. <code>./gradlew clean deploy</code></p>

<p>Hope it helps.</p>