开发者

IE CSS issue when hitting the browsers back button

开发者 https://www.devze.com 2023-03-09 20:38 出处:网络
I am having an issue with IE (9 in this case) whe开发者_开发百科re I have uploaded a new CSS file for a page and it works just fine when I go to the page.The problem I am having is when I browse to an

I am having an issue with IE (9 in this case) whe开发者_开发百科re I have uploaded a new CSS file for a page and it works just fine when I go to the page. The problem I am having is when I browse to any another page, if I then hit the back button it renders my page using a previous version of the CSS file. I verified this using the F12 tool to see that the css file only had the entries from the previous version. In this case, i was styling 'ol' and 'li' elements if that matters.

Is there anything I can do to make IE load the most current version of a css file when the browsers back button is used?

Again, the page loads perfectly if I browse to it in any "forward" manner, I also have my browser set to check for new versions every visit. Its when I hit the back button it has problems. Also every other browser ive tested has no problem using the back button.


you could add a parameter when calling the stylsheet...

?version=2

...after you .css extension


If you are clicking back to return to a page that you have previously visited with the old stylesheet, then yes, it will load the old stylesheet. A simple refresh should fix this.

The reason is that the back button is not meant to reload old pages, but to preserve the pages exact state and return the user back to that page.

If indeed you have loaded the new stylesheet on page A and then move forward to page B, then click back to go to page A and an old version of the style has been loaded, there might be something going seriously wrong with IE's cache. It might be a bug. Maybe changing the filename or adding something to the query string will force it to recognise your stylesheet as a newer version eg:

style.css?v2

will make sure the browser treats your style as a completely new file and disregard any old cached versions.

0

精彩评论

暂无评论...
验证码 换一张
取 消