Ie7 not loading my stylesheet

I have a page that works on firefox and chrome. In IE7 I experience quite an interesting behavior, the stylesheet does not load. However, if I press CTRL F5, it does.

This is very annoying, to say the least.

Does anyone have this problem? any recommendations?

FYI: the page uses jQuery and simple javascript, has CSS elements located absolutely and relatively everywhere, conditional HTML (to separate IE-specific javascript, because IE7 will not respond well to several jQuery effects combined with IE shadow filter, and also download IE-specific stylesheet that addresses some of the positioning-related violations).

+4
source share
4 answers

IE just caches css and does not check for a new one, as it has the same name. To make the new css load, you will need to change the name. Often people will do a version number to get around this bit of IE:

mySheet.001.css mySheet.002.css ...etc. 

Thus, it will be restarted for all your users the first time you change the version number - just be sure to change the link.

+2
source

A good trick to prevent caching is to use a query string in a CSS file.

Try:

 <link rel="stylesheet" type="text/css" href="style.css?v=00001" /> 

If you change the number when making changes, it will automatically reload the css file without the need to rename it. You can also do this for images and other files.

EDIT: I find this even more useful if you have a frequently changing site to use the date as a string rather than version numbers. It just makes it more understandable to humans.

i.e.

 <link rel="stylesheet" type="text/css" href="style.css?v=130906-1" /> 
+2
source

Have you tried changing your IE cache settings?

+1
source

@naspinski: No. xmars wrote that he cleared the cache. The problem does not account for changes after the update. Do not suggest using an CSS name exploit. There is a cache for something, it provides higher efficiency, and the site is not updated, and you need to be able to use this solution. In addition, Etag is the proper mechanism that should be used to run client updates, not some inaccurate workarounds.

@xmars: IE7 does not know, did not report, did not reproduce, and did not document the error regarding the binding of cascading style sheets in conditional comments. Either you are a powerful seeker of errors, or you are simply mistaken. I vote second. Link your documents here. Let's take a look at them.

0
source

All Articles