Frustrating Caching of JS and CSS files in IE8,9,10 - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Frustrating Caching of JS and CSS files in IE8,9,10

  • Frustrating Caching of JS and CSS files in IE8,9,10
  • Jacques,

    Could be any number of things that's not been setup/configured properly - hard to say from just the end result, but I'd verify caching profiles and static types/content first.

    What are you running IIS6/7/8 ?

    Jochem.
  • We're having the issues across a number of client websites which include all the versions you mentioned. But, for the current one, it's IIS6.

    Regards,
    Jacques
  • Mail is on its way...
  • 36640487-4cb5-6f77-96ac-ff0000ae3c70_ie-response-header.png
    Hi there,
    We've been experiencing this problem for quite some time and have never found a solution.
    On most of our SF sites (4.x through 5.x) no matter what we do, changed CSS and JS files do not automatically get updated on the client side.

    In our current situation, we updated a number of CSS files along with JS files which changes the user experience a little bit. If these files are not updated the UI breaks.
    1. The content of the site is updating (we added a period '.' to one of the content blocks to check, it worked)
    2. In Settings > Advanced > System > Output Cache Settings we've set all caching options to False for each of the profiles (Output and Client)
    3. We use a control called StylesheetPlaceHolder which calls in your CSS at the right time and in a specific order. We've added ?v1 to the back of each of the css files
    4. We added ?v1 to the back of each of the JavaScript files.
    5. We've reset IIS too
    Browsing the site in IE still doesn't get the right files. Only when you explicitly clear the cache or even if you hit F12 to bring up the developer tools does it load the correct files. Then it works perfectly.

    What else should we do to invalidate the client cache (or files in it).
    As I mentioned we've got this problem across all of our SF sites.

    Regards,
    Jacques

    EDIT: See the attached image showing Response Header. Good to note here is that the Last modified date is set to a year ago, which can't be right, because I just edited the page.
  • e3660487-4cb5-6f77-96ac-ff0000ae3c70_invalidatingcache.png
    @Jacques,

    Most likely you've not setup client-caching properly on IIS, Sitefinity shouldn't have anything to do with it.

    I did a quick test (see attachment) and as you can see IE has no problem with fetching an updated test-sitefinity while leaving the other css+js files cached.
  • Thanks Jochem,

    Where can I start to look at the IIS config? Or rather, what should I look at first?
    Regards,
    Jacques
  • Ah - a post on this (rather than an e-mail) would be nice :)
    We have the same issue in IIS7 for all our clients. 

    Now I know I shouldn't be snarky - because it's my own ignorance that is frustrating  -but I will forever be amazed that it's every instance of SF and yet not an SF issue.
  • @Stephen,

    In this case there were some project specific things that were better talked offline. 
    But I'm finishing up a post regarding this (for both IIS7 & IIS8) - should have it end of the week.

    Jochem
  • Jochem, I sincerely thank you for your time!  Again, I realize my frustration is primarily my own ignorance, but it would seem guidance for something so prevalent would be a bit more obviously available.

    I also realize that as a developer using sitefinity, we use it in a bit more abnormal a way than the normal user (client), so settings that might be right for the end-client do not suit development/testing.
  • Web.config transforms to the rescue :)
  • Any luck yet Jochem.  No rush, but would love to learn!
  • blog.falafel.com/.../caching-and-compression-of-static-content-with-sitefinity-5

    Actually just posted that about 45mins ago, sorry but it's been extremely busy times.

    Tomorrow I'll have part two ready, with a complete and generic web.config transform setup so you can simply drop it into your project.

    Jochem
  • This might be a little off topic but if you're developing a responsive theme with IE9 try the following - 

    F12 > Document Mode > IE9

    For some reason IE9 diverts back to IE7 or 8 even though 9 is the default mode. This will kill your media queries unless you're using some sort of polyfill library.

    IE obviously isn't my favourite browser. 
  • Jochem,

    I am having the same issues with files (including the Sitefinity License) not updating.  Did you ever do part two of this post, "creating a complete/generic web.config transform setup"? 

    Thank you!