+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Disable client side caching for javascript

Disable client side caching for javascript

7 posts, 0 answered
  1. Dan
    Dan avatar
    14 posts
    Registered:
    01 Dec 2014
    14 Jan 2015
    Link to this post

    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

  2. Craig
    Craig avatar
    45 posts
    Registered:
    28 Sep 2008
    14 Jan 2015 in reply to Dan
    Link to this post

    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

     

  3. Dan
    Dan avatar
    14 posts
    Registered:
    01 Dec 2014
    14 Jan 2015 in reply to Craig
    Link to this post

    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

  4. Dan
    Dan avatar
    14 posts
    Registered:
    01 Dec 2014
    21 Jan 2015
    Link to this post

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

     Thank you,

     Dan

  5. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    29 Nov 2016
    24 Jan 2015
    Link to this post
    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
     
  6. Dan
    Dan avatar
    14 posts
    Registered:
    01 Dec 2014
    27 Jan 2015 in reply to Svetoslav Manchev
    Link to this post

    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

     

  7. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    29 Nov 2016
    30 Jan 2015
    Link to this post
    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
     
7 posts, 0 answered