Firefox 浏览器不会重新加载更新的 CSS/JS 文件

发布于 2024-11-25 11:35:06 字数 231 浏览 5 评论 0原文

我在 Firefox 浏览器中遇到问题,因为每次更新 CSS 或 JS 文件时,我都需要清除 Firefox 浏览器的缓存才能获取更新的文件。我使用 XSP2 服务器是因为我在 ubuntu 中使用 C# 和 asp.net 开发了我的 web 应用程序。

有没有办法在 Firefox 浏览器中自动重新加载更新的 CSS/JS 文件并在服务器端或我的 web 应用程序中实现?

请指教。

非常感谢。

I'm having a problem in the firefox browser, because everytime I update my CSS or JS files, I need to clear the cache of my firefox browser to get the updated files. I'm using XSP2 server because I developed my webapp using C# and asp.net in ubuntu.

Is there any way to automatically reload the updated CSS/JS files in the firefox browser and implemented in server-side or in my webapps?

Please advise.

Many thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

锦上情书 2024-12-02 11:35:06

按住CTRL按钮并按F5。这是一次硬刷新,会清除刚刚刷新的页面的缓存。

如果您想自动重新加载其他用户的浏览器,请在 src/href 标记末尾使用随机变量。就像:

<script type="text/javascript" src="dothis.js?r=591"></script>

如果 src 总是在变化,浏览器将重新加载脚本而不使用缓存。

Hold the CTRL button and press F5. It's a hard refresh that clears the cache for the page you just refreshed.

If you want to auto-reload other users browsers, use a random variable on the end of the src/href tag. Like:

<script type="text/javascript" src="dothis.js?r=591"></script>

If the src is always changing, the browser will reload the script without using cache.

∝单色的世界 2024-12-02 11:35:06

这就是我使用的:https://addons.mozilla。 org/en-US/firefox/addon/clear-cache-button/

或者,将缓存设置为使用 0 MB:转至首选项 ->高级->网络->检查覆盖自动缓存管理,并设置为 0MB。

This is what I use: https://addons.mozilla.org/en-US/firefox/addon/clear-cache-button/

Alternatively, set your cache to use 0 MB: Go to Preferences -> Advanced -> Network -> check override automatic cache management, and set to 0MB.

打小就很酷 2024-12-02 11:35:06

您可能会弄乱标头的缓存,但最简单的方法就是在您希望更改更新的元素时将它们附加到查询字符串...

我知道这听起来不是一个好的解决方案,但是当您开始时出于性能原因缩小并组合您的 js 和 css 文件,大多数解决方案都会更改 url 以在资源发生变化时获取这些资源...

You could mess with the cache of the headers, but the easiest thing to do is simply append your updated elements with a querystring when you want them to change...

I know this doesn't sound like a good solution, but when you begin minifying and combining your js and css files for performance reasons, most of the solutions will change the url to get these resources when they change anyway...

牛↙奶布丁 2024-12-02 11:35:06

有多种方法可以确保用户在您的网页上看到最新内容。以一定的时间间隔刷新页面或阻止浏览器缓存网页,每次返回时都会加载新鲜的数据。

=====
根本不允许用户将数据存储在缓存中:

<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 

在 和 标记之间添加此内容,页面将永远不会被兑现。

=====
一定时间间隔后刷新页面:

<meta HTTP-EQUIV="Refresh" CONTENT=300>

在 和 标签之间添加此内容,页面将永远不会被兑现。


另一个解决方案:
这里< /a>


或:

<%@ OutputCache Location="None" VaryByParam="None" %>

来源:此处

There are a couple of ways to make sure the users see the latest content on your web pages. Refresh the pages at certain time intervals or block the browser from caching the web page, each time they return they will load the data fresh.

=====
Do not allow the user to store the data in cache at all:

<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 

Add this between the and tag and the page will never be cashed in the first place.

=====
Refresh the page after a certain time interval:

<meta HTTP-EQUIV="Refresh" CONTENT=300>

Add this between the and tag and the page will never be cashed in the first place.


Another solution :
Here


or :

<%@ OutputCache Location="None" VaryByParam="None" %>

source : Here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文