added parameter in url of javascript file in portlet

thumbnail
major major, modified 12 Years ago. New Member Posts: 13 Join Date: 11/1/12 Recent Posts
Im using Liferay 6.06.
I wrote this line in jsp file in a portlet:
<script type="text/javascript" src="<%=request.getContextPath()%>/js/myfile.js"></script>
The url of the file in the broswer is like this:
/js/myfile.js?_=1382519010094
why liferay add _=1382519010094 to the url?
thumbnail
Antoine Comble, modified 12 Years ago. Regular Member Posts: 232 Join Date: 9/7/12 Recent Posts
Hi,

I think Liferay adds it to not cache our js file in your browser.
In portal-developer.properties file, a key exists to avoid this :
{code}
javascript.fast.load=true
javascript.log.enabled=false
{code}

Hope thi help you,

Antoine
thumbnail
major major, modified 12 Years ago. New Member Posts: 13 Join Date: 11/1/12 Recent Posts
Thanks but it didn't work for meemoticon
thumbnail
Olaf Kock, modified 11 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Parameters like the given one (a timestamp) are typically used to specifically make content cacheable: While a file named myFile.js might update, so you can't cache it for eternity, a file that has its timestamp in the URL can be cached for eternity, because it will get a new timestamp once it's updated.

The "javascript.fast.load" parameter typically concatenates all js files into a single one (and minifies it) so that you get all JS with a single http request, which is dramatically faster than sending 30 (or however many) individual requests.