Disable client side caching for javascript

Posted by Community Admin on 04-Aug-2018 16:22

Disable client side caching for javascript

All Replies

Posted by Community Admin on 14-Jan-2015 00:00

Hi,

We would like to disable client side caching for .js files.  Is this possible through the Sitefinity backend or through web.config?

We are using SF 6.1

 Thank you,

 Dan

Posted by Community Admin on 14-Jan-2015 00:00

Dan,

Try adding the following configuration under the system.webServer node in the web.config file.

<staticContent>
      <clientCache cacheControlMode="NoControl" />
    </staticContent>
    <caching enabled="true" enableKernelCache="true">
      <profiles>
        <add extension=".js" policy="DisableCache" kernelCachePolicy="DisableCache" />
      </profiles>
    </caching>
 

 Craig

 

Posted by Community Admin on 14-Jan-2015 00:00

Thanks for responding Craig,

I could be wrong, and please tell me if I am, but I believe this would simply not add Cache headers in the responses for all static content meaning the client wouldn't cache any static content (we only want them to explicitly not cache Javascript).  It would also disable server side caching for Javascript files which isn't necessary.  Moreover, I believe that SF hooks into the request pipeline and manually sets the cache headers which is why I'm curious as to what the SF team has to say.

 Thanks!

 Dan

Posted by Community Admin on 21-Jan-2015 00:00

Could someone from the SF team please confirm Craig's suggestion or provide additional insight?

 Thank you,

 Dan

Posted by Community Admin on 24-Jan-2015 00:00

Hi Dan,

The proposed solution by Craig seems correct as it should filter the setting to JasvaScript only but not disable for all StaticControl.

Furthermore this setting should have response header that tells browser not to cache the JS.

I hope this information helps.

Regards,
Svetoslav Manchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 27-Jan-2015 00:00

Hi,

 Thanks for responding, but unfortunately, Craig's solution did not work.  We are still getting 304's even when Pragma: No-Cache is sent in the request. (see attached file)

Any other ideas?

 Thanks!

 Dan

 

Posted by Community Admin on 30-Jan-2015 00:00

Hi Dan,

The js files are cached on the browser, so you can try the solutions proposed in that forum thread.

Regards,
Svetoslav Manchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed