# When is site.min.js refreshed?

**URL:** <https://forum.litium.com/t/when-is-site-min-js-refreshed/1360>\
**Category:** Questions\
**Tags:** litium-6\
**Created:** [February 27, 2020, 1:57pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360 "2020-02-27T13:57:02Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [February 27, 2020, 1:57pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/1 "2020-02-27T13:57:02Z")

</div>

There is the V parameter on the site.min.js. (?v=random-string)  
When is the site.min.js name changed so the browser wont read it from the cache?

Litium version: 6

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [February 27, 2020, 2:34pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/2 "2020-02-27T14:34:15Z")

</div>

The random string is the hash of the content of the file. Update the content of the file and the hash will be changed.

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [February 27, 2020, 2:55pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/3 "2020-02-27T14:55:04Z")

</div>

Is there a possibility that chrome and safari on Mac are caching it different?

On 3 deploys now it haven’t been a problem for me, but the client complains on some errors that have been resolved by refreshing the cache.

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [February 27, 2020, 2:57pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/4 "2020-02-27T14:57:39Z")

</div>

I did a test on what you said, and it indeed seems to update the name, so that works

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [February 27, 2020, 3:09pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/5 "2020-02-27T15:09:13Z")

</div>

I think all browsers are following the http-standard and caching files depend on the full url with query string.

If you have multiple servers it exists possibility that the html is downloaded from a server that have the file updated and a new hash, the second request to download the new css/js file will come to a server that not is updated and the content is downloaded to the browser and cached for wrong hash-query-parameter.

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [February 27, 2020, 3:23pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/6 "2020-02-27T15:23:33Z")

</div>

It’s for ByRydens on a single server where Litium is the host, so it shoulde’t be any special things done to that site. It’s strange but i guess we will leave it for now and do a closer look next release.

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [March 2, 2020, 9:49am UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/7 "2020-03-02T09:49:09Z")

</div>

Do you see any instance where this could be a problem?

Our client wasen’t using the site the entire last week, opened it today and still had the cache problem. Started working after “ctrl + f5”.  
Is it possible that the HTML gets cached? Because the v= parameter was indeed updated.

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [March 2, 2020, 10:30am UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/8 "2020-03-02T10:30:18Z")

</div>

We got 1 more example now:  
I have the same setup but not the problem

Windows, Chrome.

Open [Byrydens.com](http://Byrydens.com) =\> Old Hash  
Ctrl + F5 =\> New hash

Any thoughts?

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [March 2, 2020, 4:12pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/9 "2020-03-02T16:12:10Z")

</div>

When loading your site the cache header for the stylesheet is not included. Do you have the caching in web.config commented out?

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [March 3, 2020, 8:00am UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/10 "2020-03-03T08:00:25Z")

</div>

Hmm, i guess you mean this part?

```
 <location path="ui">
<system.web>
  <customErrors mode="Off" />
</system.web>
<system.webServer>
  <httpErrors>
    <remove statusCode="500" subStatusCode="-1" />
    <remove statusCode="404" subStatusCode="-1" />
  </httpErrors>
  <!-- 
enable static content cache to get better performance and pagespeed.
if static content in this folder is changed during the cache-time it 
is not reflected to the client before cache expires or user are doing 
a hard refresh.
-->
  <staticContent>
    <!--<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="06:00:00" />-->
  </staticContent>
</system.webServer>

```

Should i remove the comment on “clientCache”? I can’t recall us ever changing anything about this

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [March 3, 2020, 2:55pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/11 "2020-03-03T14:55:28Z")

</div>

@patric.forsgard any idea? Apperently more clients are experiencing it

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [March 3, 2020, 3:15pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/12 "2020-03-03T15:15:05Z")

</div>

If the `clientCache` is commented out, then the browser will use the ETag to decide if the information should be reused. if the `clientCache` is in use, the appropriate cache header is added to the request.

Not sure if enable that the file should be cached at the client will solve your issue either but I think it is worth a try.

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [March 3, 2020, 3:28pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/13 "2020-03-03T15:28:36Z")

</div>

I’m not exactly sure what you mean that i should try  
i tried adding this

```
 <staticContent>
    <clientCache cacheControlMode="DisableCache" />
 </staticContent>

```

Then it should reload every time, mabye worth a try?

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [March 3, 2020, 5:32pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/14 "2020-03-03T17:32:01Z")

</div>

I have never tried `DisableCache` and that seams to be a performance killer… I think that you should remove comment on the default value `<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="06:00:00" />` and the file will be cached in 6 hours and then a check is made to the server.

I haven’t hear about your problem from anyone else and I don’t have any answer for you why you site behave like this.

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [March 4, 2020, 10:52am UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/15 "2020-03-04T10:52:22Z")

</div>

We found the issue now, I guess we can blame my lack of knowlage, I had added a parameter to “settings.addToCartUrl” in the SiteInfoController, and diden’t know that got cached until the websitesttings is update…

So now it works after republishing websitesettings.  
I guess we should look into adding assembly version or something to that hash to.

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [March 4, 2020, 11:30am UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/16 "2020-03-04T11:30:09Z")

</div>

Good that you find the reason.

> [@Ericsj11](#):
>
> I guess we should look into adding assembly version or something to that hash to.

Adding assembly version to the hash may get the file to reload at client when it not is needed.

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [March 4, 2020, 12:18pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/17 "2020-03-04T12:18:19Z")

</div>

Yes, thats true. But might be worth that extra reload to prevent this type of error to occure again

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [April 1, 2020, 12:18pm UTC](https://forum.litium.com/t/when-is-site-min-js-refreshed/1360/18 "2020-04-01T12:18:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
