热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何关闭Firefox上的缓存?-HowtoturnoffcachingonFirefox?

DuringdevelopmentIhavetoclearcacheinFirefoxallthetimeinordertomakeitusethelates

During development I have to "clear cache" in Firefox all the time in order to make it use the latest version of Javascript files.

在开发过程中,我必须一直在Firefox中“清除缓存”,以便让它使用最新版本的Javascript文件。

Is there some kind of setting (about:config) to turn off caching completely for Javascript files? Or, if not, for all files?

是否有某种设置(about:config)来完全关闭Javascript文件的缓存?或者,如果不是,对所有文件?

17 个解决方案

#1


220  

Enter "about:config" into the Firefox address bar and set:

在Firefox地址栏输入“about:config”并设置:

browser.cache.disk.enable = false
browser.cache.memory.enable = false

If developing locally, or using HTML5's new manifest attribute you may have to also set the following in about:config -

如果在本地开发,或者使用HTML5的新manifest属性,您可能还需要在about中设置以下内容:config -

browser.cache.offline.enable = false

#2


61  

The Web Developer Toolbar has an option to disable caching which makes it very easy to turn it on and off when you need it.

Web Developer Toolbar有一个禁用缓存的选项,当您需要时,可以很容易地打开和关闭它。

#3


12  

Have you tried to use CTRL-F5 to update the page?

你试过使用CTRL-F5来更新页面吗?

#4


10  

There is no specific option to disable caching only for Javascript, you will have to disable caching entirely.

只有Javascript才能禁用缓存,没有特定的选项,您必须完全禁用缓存。

FireBug has an option to disable the browser cache on the Network tab's drop down menu.

FireBug有一个选项可以在Network选项卡的下拉菜单上禁用浏览器缓存。

#5


8  

On the same page you want to disable the caching do this : FYI: the version am working on is 30.0

在相同的页面上,您希望禁用缓存:FYI:该版本正在处理的是30.0。

You can :

您可以:

open webdeveloper toolbar open web developer

and pick disable cache

After that it will reload page from its own (you are on) and every thing is recached and any furthure request are recahed every time too and you may keep the web developer open always to keep an eye and make sure its always on (check).

在那之后,它将重新加载自己的页面(您是on的),每件事都被重新处理,任何furthure请求也会被重新处理,您可以保持web开发人员始终保持开放,以保持关注并确保它始终处于打开状态(检查)。

#6


7  

If you're working with server side code you could generate a random number and append it to the end of the src in the following manner....

如果您正在使用服务器端代码可以生成一个随机数并将它附加到src的结束以下列方式....

src="yourJavascriptFile.js?randomNumber=434534"

src = " yourJavascriptFile.js ? randomNumber = 434534 "

with the randomNumber being randomly generated each time.

每次随机生成随机数。

#7


6  

Firefox 48 Developer Tools

Firefox 48开发工具

Allows you to turn off cache only when toolbox is open, which is perfect for web development:

允许您仅在工具箱打开时关闭缓存,这对于web开发是完美的:

  • F12
  • F12
  • gearbox on right upper corner
  • 变速箱在右上角
  • scroll down top Advanced settings
  • 向下滚动顶部高级设置
  • check "Disable Cache (when toolbox is open)"
  • 检查“禁用缓存(当工具箱打开时)”

enter image description here

https://stackoverflow.com/a/27397425/895245 has similar content, but positioning changed a bit since.

https://stackoverflow.com/a/27397425/895245也有类似的内容,但是定位从那以后就有点变化了。

#8


4  

I know I'm resurrecting an ancient question, but I was trying to solve this problem today and have an alternate solution. Toggling caching when I want to test was not really acceptable for me, and as others mentioned, hard refreshing (ctrl+shift+r) doesn't always work.

我知道我在重新提出一个古老的问题,但我今天试图解决这个问题,并有另一个解决方案。当我想要测试时切换缓存并不是真的可以接受的,正如其他人提到的,硬刷新(ctrl+shift+r)并不总是有效。

Instead, I opted to put the following in my vhost.conf file (can also be done in .htaccess) on my dev environment:

相反,我选择在vhost中添加以下内容。在我的开发环境上的conf文件(也可以在.htaccess中执行):


FileETag None

Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"


On my dev environment, this ensures that js and css are always retrieved. Additionally it doesn't affect the rest of my browsing, and it also works for all browsers, so testing in chrome / ie etc is also easy.

在我的开发环境中,这确保始终检索js和css。此外,它不影响我的其他浏览,它也适用于所有浏览器,所以在chrome / ie等环境下测试也很容易。

Found the snippet here, some other handy apache tricks as well: http://www.askapache.com/htaccess/using-http-headers-with-htaccess.html#prevent-caching-with-htaccess

在这里找到了这个代码片段,还有一些其他便利的apache技巧:http://www.askapache.com/htaccess/using-http-header - htac.html #prevent- cache -htaccess

To make sure that my clients always see the latest version on production, we increment the query string on the js include on each update, ie

为了确保我的客户总是在产品上看到最新的版本,我们在每次更新时增加js包含的查询字符串

jquery.somefile.js?v=0.5

This forces my clients' browsers to update their local cache when they see a new querystring, but then caches the new copy until the file is updated again

这迫使我的客户端浏览器在看到新的querystring时更新本地缓存,然后缓存新的副本,直到再次更新文件

#9


3  

Best strategy is to design your site to build a unique URL to your JS files, that gets reset every time there is a change. That way it caches when there has been no change, but imediately reloads when any change occurs.

最好的策略是设计您的站点来为您的JS文件构建一个惟一的URL,每次发生更改时都要重置该URL。这样,当没有更改时,它会缓存,但当发生任何更改时,它会立即重新加载。

You'd need to adjust for your specific environment tools, but if you are using PHP/Apache, here's a great solution for both you, and the end-users.

您需要针对特定的环境工具进行调整,但是如果您正在使用PHP/Apache,那么对于您和最终用户来说,这里有一个很好的解决方案。

http://verens.com/archives/2008/04/09/Javascript-cache-problem-solved/

http://verens.com/archives/2008/04/09/Javascript-cache-problem-solved/

#10


3  

You can use CTRL-F5 to reload bypassing the cache.

可以使用CTRL-F5重载绕过缓存。

You can set the preferences in firefox not to use the cache

您可以在firefox中设置不使用缓存的首选项

network.http.use-cache = false

You can setup you web server to send a no-cache/Expires/Cache-Control headers for the js files.

您可以设置web服务器为js文件发送无缓存/过期/缓存控制头。

Here is an example for apache web server.

下面是apache web服务器的一个示例。

#11


3  

If you use FireBug, on the Network tab's drop down menu there is an option do disable the browser's cache.

如果使用FireBug,在Network选项卡的下拉菜单上有一个选项可以禁用浏览器的缓存。

enter image description here

#12


1  

There are pros and cons to the last two solutions posted, but they're both IMHO great solutions.

最后两种解决方案都有优点和缺点,但它们都是很棒的解决方案。

  1. You may or may not want your session ID embedded in your url like that for tighter security. But in development that shouldn't matter, but what if you forget to remove it? Also does that really work? Wouldn't you need something like a sequential number generator (hit count stored in the session, or maybe even just if 1 then 0, if 0 then 1)?

    为了更严格的安全性,您可能希望会话ID像这样嵌入到url中,也可能不希望这样。但在开发过程中,这并不重要,但如果您忘记删除它呢?这真的有用吗?难道你不需要一个序列数字生成器(在会话中存储的命中计数,或者即使是1然后0,如果0然后1)吗?

  2. Adding a session id (or whatever sequencer) means you need to remember to add it to every resource you don't want cached. On the one hand that's better because you can just include your session id with just that resource you're actively developing and testing. On the other hand, it means you have to do that and you have to remember to remove that for production.

    添加会话id(或任何序列)意味着您需要记住将它添加到不希望缓存的每个资源。一方面,这更好,因为您可以只使用正在积极开发和测试的资源来包含会话id。另一方面,这意味着你必须这么做,而且你必须记住为了生产而删除它。

  3. Modifying the vhost.conf or the .htaccess file does the trick nicely without the need to remember to add and remove the session id. But the downside is performance of all js and css resources will be affected, and if you have large files, that's going to slow you down.

    vhost修改。conf或.htaccess文件很好地解决了这个问题,无需记住添加和删除会话id。

Both seem like great, elegant solutions -- depends on your needs.

这两种方法看起来都很棒,都很优雅——这取决于你的需要。

#13


1  

I use CTRL-SHIFT-DELETE which activates the privacy feature, allowing you to clear your cache, reset COOKIEs, etc, all at once. You can even configure it so that it just DOES it, instead of popping up a dialog box asking you to confirm.

我使用CTRL-SHIFT-DELETE来激活隐私特性,允许你一次清除缓存、重置COOKIE等等。你甚至可以对它进行配置,这样它就可以做到这一点,而不是弹出一个对话框要求你确认。

#14


1  

In higher versions of Firefox, like Nightly, there is an options named "disable cache", you can find it by clicking the gear. And that options works only in current session, which means when you close inspector and restart it, you have to check it again if you want catch disabled.

在更高版本的Firefox中,比如Nightly,有一个名为“禁用缓存”的选项,你可以通过点击gear找到它。该选项仅在当前会话中有效,这意味着当您关闭检查器并重新启动它时,如果您希望禁用catch,您必须再次检查它。

#15


0  

After 2 hours of browsing for various alternatives, this is something that worked for me.

在浏览了两个小时的各种选择之后,这对我来说很有用。

My requirement was disabling caching of js and css files in my spring secured web application. But at the same time caching these files "within" a particular session.

我的要求是在我的spring安全web应用程序中禁用js和css文件的缓存。但与此同时,将这些文件“缓存到”一个特定的会话中。

Passing a unique id with every request is one of the advised approaches.

在每个请求中传递唯一的id是建议的方法之一。

And this is what I did :- Instead of

这就是我所做的:-而不是


I used

我使用


Any cons to the above approach are welcome. Security Issues ?

欢迎对上述方法提出反对意见。安全问题?

#16


0  

In firefox 45, disk cache options can be set by changing the value of: browser.cache.disk.enable

在firefox 45中,可以通过更改:browres .cache.disk.enable来设置磁盘缓存选项

The value can be set on the "about:config" page.

可以在“about:config”页面上设置该值。

On http://kb.mozillazine.org/About:config_entries#Browser I found the following description for "browser.cache.disk.enable":

在http://kb.mozillazine.org/About:config_entries#浏览器中,我找到了“browser.cache.disk.enable”的描述:

True (default): Use disk cache, up to capacity specified in browser.cache.disk.capacity False: Disable disk cache (same effect as setting browser.cache.disk.capacity to 0)

True(默认):使用磁盘缓存,直到浏览器.cache.disk中指定的容量为止。容量错误:禁用磁盘缓存(与设置browsr .cache.disk相同的效果)。容量为0)

#17


0  

First of All, this can be easily done, for e.g. by PHP to force the browser to renew files based on cache date (expiration time). If you just need it for experimental needs, then try to use ctrl+shift+del to clear all cache at once inside Firefox browser. The third solution is to use many add-ons that exits for Firefox to clear cache based on time lines.

首先,这很容易做到,例如,PHP可以强制浏览器根据缓存日期(过期时间)更新文件。如果您只是为了实验需要而需要它,那么尝试使用ctrl+shift+del来一次清除Firefox浏览器中的所有缓存。第三种解决方案是使用许多为Firefox提供的插件来基于时间线清除缓存。


推荐阅读
  • IhaveawebapplicationthatusesanActiveXCOMcomponent,forexample:我有一个使用ActiveXCOM组件的Web应用程 ... [详细]
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
  • 本文介绍了使用AJAX的POST请求实现数据修改功能的方法。通过ajax-post技术,可以实现在输入某个id后,通过ajax技术调用post.jsp修改具有该id记录的姓名的值。文章还提到了AJAX的概念和作用,以及使用async参数和open()方法的注意事项。同时强调了不推荐使用async=false的情况,并解释了JavaScript等待服务器响应的机制。 ... [详细]
  • Java序列化对象传给PHP的方法及原理解析
    本文介绍了Java序列化对象传给PHP的方法及原理,包括Java对象传递的方式、序列化的方式、PHP中的序列化用法介绍、Java是否能反序列化PHP的数据、Java序列化的原理以及解决Java序列化中的问题。同时还解释了序列化的概念和作用,以及代码执行序列化所需要的权限。最后指出,序列化会将对象实例的所有字段都进行序列化,使得数据能够被表示为实例的序列化数据,但只有能够解释该格式的代码才能够确定数据的内容。 ... [详细]
  • 本文介绍了使用postman进行接口测试的方法,以测试用户管理模块为例。首先需要下载并安装postman,然后创建基本的请求并填写用户名密码进行登录测试。接下来可以进行用户查询和新增的测试。在新增时,可以进行异常测试,包括用户名超长和输入特殊字符的情况。通过测试发现后台没有对参数长度和特殊字符进行检查和过滤。 ... [详细]
  • http:my.oschina.netleejun2005blog136820刚看到群里又有同学在说HTTP协议下的Get请求参数长度是有大小限制的,最大不能超过XX ... [详细]
  • 在重复造轮子的情况下用ProxyServlet反向代理来减少工作量
    像不少公司内部不同团队都会自己研发自己工具产品,当各个产品逐渐成熟,到达了一定的发展瓶颈,同时每个产品都有着自己的入口,用户 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • JavaScript和HTML之间的交互是经由过程事宜完成的。事宜:文档或浏览器窗口中发作的一些特定的交互霎时。能够运用侦听器(或处置惩罚递次来预订事宜),以便事宜发作时实行相应的 ... [详细]
  • 本文介绍了如何在Azure应用服务实例上获取.NetCore 3.0+的支持。作者分享了自己在将代码升级为使用.NET Core 3.0时遇到的问题,并提供了解决方法。文章还介绍了在部署过程中使用Kudu构建的方法,并指出了可能出现的错误。此外,还介绍了开发者应用服务计划和免费产品应用服务计划在不同地区的运行情况。最后,文章指出了当前的.NET SDK不支持目标为.NET Core 3.0的问题,并提供了解决方案。 ... [详细]
  • Servlet多用户登录时HttpSession会话信息覆盖问题的解决方案
    本文讨论了在Servlet多用户登录时可能出现的HttpSession会话信息覆盖问题,并提供了解决方案。通过分析JSESSIONID的作用机制和编码方式,我们可以得出每个HttpSession对象都是通过客户端发送的唯一JSESSIONID来识别的,因此无需担心会话信息被覆盖的问题。需要注意的是,本文讨论的是多个客户端级别上的多用户登录,而非同一个浏览器级别上的多用户登录。 ... [详细]
  • ShiftLeft:将静态防护与运行时防护结合的持续性安全防护解决方案
    ShiftLeft公司是一家致力于将应用的静态防护和运行时防护与应用开发自动化工作流相结合以提升软件开发生命周期中的安全性的公司。传统的安全防护方式存在误报率高、人工成本高、耗时长等问题,而ShiftLeft提供的持续性安全防护解决方案能够解决这些问题。通过将下一代静态代码分析与应用开发自动化工作流中涉及的安全工具相结合,ShiftLeft帮助企业实现DevSecOps的安全部分,提供高效、准确的安全能力。 ... [详细]
  • Spring框架《一》简介
    Spring框架《一》1.Spring概述1.1简介1.2Spring模板二、IOC容器和Bean1.IOC和DI简介2.三种通过类型获取bean3.给bean的属性赋值3.1依赖 ... [详细]
  • 本文整理了Java中com.evernote.android.job.JobRequest.getTransientExtras()方法的一些代码示例,展示了 ... [详细]
author-avatar
睿哲小宝贝
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有