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

Posted by Community Admin on 04-Aug-2018 13:34

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

All Replies

Posted by Community Admin on 18-Mar-2013 00:00

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.

Posted by Community Admin on 18-Mar-2013 00:00

@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.

Posted by Community Admin on 18-Mar-2013 00:00

Thanks Jochem,

Where can I start to look at the IIS config? Or rather, what should I look at first?
Regards,
Jacques

Posted by Community Admin on 18-Mar-2013 00:00

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.

Posted by Community Admin on 18-Mar-2013 00:00

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

Posted by Community Admin on 18-Mar-2013 00:00

Mail is on its way...

Posted by Community Admin on 20-Mar-2013 00:00

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.

Posted by Community Admin on 20-Mar-2013 00:00

@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

Posted by Community Admin on 20-Mar-2013 00:00

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.

Posted by Community Admin on 20-Mar-2013 00:00

Web.config transforms to the rescue :)

Posted by Community Admin on 04-Apr-2013 00:00

Any luck yet Jochem.  No rush, but would love to learn!

Posted by Community Admin on 04-Apr-2013 00:00

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

Posted by Community Admin on 20-Jun-2013 00:00

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. 

Posted by Community Admin on 25-Jul-2013 00:00

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!

Posted by Community Admin on 25-Jul-2013 00:00

Hey James,

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

A sample transformation file is up at Github: github.com/.../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

Posted by Community Admin on 25-Jul-2013 00:00

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! 

Posted by Community Admin on 26-Jul-2013 00:00

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.

Posted by Community Admin on 26-Jul-2013 00:00

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

This thread is closed