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

Forums / Developing with Sitefinity / Frustrating Caching of JS and CSS files in IE8,9,10

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

18 posts, 0 answered
  1. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    18 Mar 2013
    Link to this post
    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.
  2. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    18 Mar 2013 in reply to Jacques
    Link to this post
    @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.
  3. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    18 Mar 2013 in reply to Jochem Bökkers
    Link to this post
    Thanks Jochem,

    Where can I start to look at the IIS config? Or rather, what should I look at first?
    Regards,
    Jacques
  4. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    18 Mar 2013 in reply to Jacques
    Link to this post
    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.
  5. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    18 Mar 2013 in reply to Jochem Bökkers
    Link to this post
    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
  6. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    18 Mar 2013 in reply to Jacques
    Link to this post
    Mail is on its way...
  7. Stephen
    Stephen avatar
    25 posts
    Registered:
    07 Feb 2013
    20 Mar 2013
    Link to this post
    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.
  8. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    20 Mar 2013 in reply to Stephen
    Link to this post
    @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
  9. Stephen
    Stephen avatar
    25 posts
    Registered:
    07 Feb 2013
    20 Mar 2013 in reply to Jochem Bökkers
    Link to this post
    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.
  10. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    20 Mar 2013 in reply to Stephen
    Link to this post
    Web.config transforms to the rescue :)
  11. Stephen
    Stephen avatar
    25 posts
    Registered:
    07 Feb 2013
    04 Apr 2013 in reply to Jochem Bökkers
    Link to this post
    Any luck yet Jochem.  No rush, but would love to learn!
  12. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    04 Apr 2013 in reply to Stephen
    Link to this post
    http://blog.falafel.com/Blogs/JochemBokkers/jochem-bokkers/2013/04/04/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
  13. Jack
    Jack avatar
    1 posts
    Registered:
    22 May 2013
    20 Jun 2013
    Link to this post
    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. 
  14. James
    James avatar
    3 posts
    Registered:
    17 Jun 2013
    25 Jul 2013 in reply to Jochem Bökkers
    Link to this post
    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!
  15. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    25 Jul 2013 in reply to James
    Link to this post
    Hey James,

    Yes I did back in April, the blog link is: http://blog.falafel.com/Blogs/jochem-bokkers/2013/04/05/caching-and-compression-with-web.config-transformations-(part-two)

    A sample transformation file is up at Github: https://github.com/FalafelSoftwareInc/Sitefinity/tree/master/Config.Transformations

    What files in general are you referring to? Sitefinity configuration files etc or content files that are used when browsing the website?

    Jochem
  16. James
    James avatar
    3 posts
    Registered:
    17 Jun 2013
    25 Jul 2013 in reply to Jochem Bökkers
    Link to this post
    Jochem,

    The issue is with a javascript file.  I assume that this is why i was having issues with the license and as I just realized that this was actually happening, I should probably check my style sheets as well.

    Does it sound like this is the correct fix for me?

    Thanks! 
  17. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    26 Jul 2013 in reply to James
    Link to this post
    Hey James,

    Sitefinity loads .config files and .lic file etc at the start of the application, so unless you specifically go into admin settings and load/save an option it won't 'refresh' those files from disk. That's why I asked if it was a sitefinity or a 'content' file.

    IIS has sometimes a bit of a problem with 'virtual files' and noticing they've been updated but depending on how you're loading the .js / .css files there are several ways around it to ensure it always goes correctly.

    Are you calling the .js from code or from a widget? Does it update frequently or is it just a development inconvinience?

    Jochem.
  18. James
    James avatar
    3 posts
    Registered:
    17 Jun 2013
    26 Jul 2013 in reply to Jochem Bökkers
    Link to this post
    Jochem,
    We got the javascript files updating. It was caused by a setting within IIS. I didn’t fix it so I can’t share exactly where the problem was but this did not correct the license issue.

    For the license issue, you explained that I need to go into admin settings and load/save them.

    Here is what I have tried:
    I went into the App_Data/Sitefinity folder that the license is located and uploaded the new license, then I went into Administration/Version & Licensing and clicked the refresh link.

    When that did not work, I tried the “activate new” button within Administration/Version & Licensing and followed those instructions.

    At the top of “Version & Licensing” everything looks fine (shown below) but I continue to receive the “you are running a trial version” message:

    Sitefinity 6.0.4210.0 Professional Edition
    Build 6.0.4210.0

    Thanks again for any/all help!

    James
18 posts, 0 answered