浏览器(或者是 Visual Studio?)似乎正在缓存样式表,因此我所做的任何更改
我使用样式表作为主题的一部分,似乎 IE 和 Firefox(或者 VS Express 版本)都在缓存此样式表,因为我对样式表所做的任何更改(例如更改属性值等)不会反映在显示的页面上。知道如何阻止浏览器或 Visual Studio 缓存此样式表吗?
顺便说一句 – 仅缓存样式表,而不缓存整个页面
另外,当我注意到对样式表所做的任何更改都没有反映在显示的页面上时,我已从 Firefox 切换到 IE。第一次在 IE 中加载页面时,页面按应有的方式显示(反映了我对样式表所做的所有更改),但随后 IE 也开始缓存样式
表
I’m using a stylesheet as part of a theme and it seems that both IE and Firefox ( or perhaps VS express edition) are caching this stylesheet, since any changes I make to a stylesheet ( such as changing attribute values etc ) aren’t reflected on the displayed page. Any idea how to prevent browser or visual studio from caching this stylesheet?
BTW – only stylesheet is cached, not the entire page
Also, when I've noticed that any changes made to a stylesheet aren’t reflected on a displayed page, I’ve switched from firefox to IE. The first time the page was loaded in IE, page was displayed as it should (reflecting all the changes I’ve made to the stylesheet), but then IE also started caching the stylesheet
thanx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
如果您的 Firefox 带有 Web Developer 工具栏,您可以轻松禁用缓存。您也可以使用Ctrl+F5刷新页面。按住 Ctrl 会告诉浏览器执行忽略缓存的强制刷新。
If you have Firefox with the Web Developer toolbar, you can easily disable caching. You can also use Ctrl+F5 to refresh the page. Holding Ctrl tells the browser to perform a forced refresh that ignores the cache.
一种选择是以不允许浏览器缓存样式表的方式链接到样式表。我发现在处理 Facebook 应用程序之类的事情时就是这种情况。
One option is to link to the stylesheet in a manner that doesn't allow the browser to cache it. I find this is th case when dealing with things like facebook apps and such.
您可以尝试将版本号添加到 css href:
查询字符串 (v1.0.1) 不会影响 css,但如果数字增加,浏览器会重新加载样式表 (
stylesheet.css
)。You could try adding version numbers to your css href:
<link rel="stylesheet" type="text/css" href="path/to/stylsheet.css?v1.0.1" />
The query string (v1.0.1) doesn't affect the css as such, but if the number increments the browser reloads the stylesheet (
stylesheet.css
).拥有汇编版本也是一个好主意:
[CB]
[MARKUP]
Having the assembly version is also a good idea:
[CB]
[MARKUP]
这个人有一个脚本,您可以将其放置在您的asp页面中,FWIW
This guy has a script you can place in your asp pages, FWIW
您可以尝试在单击刷新按钮时按下 Shift 按钮 - 这对我来说一直有效。
You can try hitting the shift button when you click the refresh button -- this always worked for me.
正如大家所说,按Ctrl+F5刷新页面。
如果这不起作用,那么这是您设计的页面还是在组中共享的项目的一部分?编写代码的人可能会经常缓存样式表或页面,以减少带宽消耗。
As everyone said, press Ctrl+F5 to refresh the page.
If that isn't working then, is this a page you designed or is it part of a project that is shared in the group? It's possible that who ever coded it might be caching the style sheets or page every so often to reduce bandwidth spent.
您可以尝试使用元标记来指示该页面似乎已过期。
例如:
我发现浏览器并不总是考虑这些元标记。 IE 似乎最擅长检测页面不应被缓存/内容是否已过期。
否则,请刷新页面以按照已建议的方式重新加载内容。
-弗林尼
You could try using meta tags to indicate that the page is appears to be expired.
For example:
I have found that these meta tags aren't always taken into consideration by browsers. IE seems to be the best at detecting that the page shouldn't be cached/the content is expired.
Otherwise, refresh the page to reload the content as has already been suggested.
-Frinny