我正在开发一个ASP.net应用程序。
我必须经常更新我的CSS文件。我不想在Firefox中about:config
更新文档频率设置。我想让它默认。
我使用Firefox作为理想的浏览器。如果我只是更新我的CSS文件,我必须清除Firefox的整个缓存。
我想从Firefox缓存中删除特定文件。这在Firefox中是否可行。我可以在Firefox中删除特定的cookie。我不能从Firefox缓存中删除特定文件吗?
如果不可能那么请告诉我如何制作我的CSS文件的方式应该始终检查(并且只有在修改时加载)才能获得更新的版本。我不想在任何情况下更改Firefox设置。
答案 0 :(得分:3)
如果我没记错的话,键组合CTRL + F5会清除缓存,并且必须重新加载css文件。
答案 1 :(得分:1)
使用ETag将是一个不错的选择。通过在HTTP响应中设置Max-Age Header,您可以允许客户端在有限时间内缓存资源。在此之后,客户端将向服务器发出条件GET请求。如果请求中的ETag(存储在If-None-Match标头中)与服务器上的ETag不匹配,则修改后的资源将被发送到客户端。否则,服务器以HTTP 304 Not Modified响应,客户端可以再次在有限时间内缓存内容。此方法可用于特定文件或目录。
答案 2 :(得分:1)
向链接文件添加上次更新时间戳。 这就是它在php中的样子
<link type="text/css" rel="stylesheet" href="css/style.css?lu=<?php echo filectime('css/style.css') ?>" />
这将导致浏览器仅在文件更新时重新加载文件。
答案 3 :(得分:1)
这可以通过几行脚本(在浏览器控制台上运行 <camel:route id="AtoIntegration">
<camel:from
uri="spring-ws:someEndPoint" />
<camel:bean ref="testAsyncPreprocessor" />
<camel:inOnly uri="activemq:requestqueue" />
</camel:route>
<camel:route id="integrationToB">
<camel:from uri="activemq:requestqueue" />
<camel:transacted />
<camel:bean ref="afterQueueProcessor" />
<camel:setHeader headerName="CamelHttpMethod">
<camel:constant>POST</camel:constant>
</camel:setHeader>
<camel:setHeader headerName="Content-Type">
<camel:constant>application/x-www-form-urlencoded</camel:constant>
</camel:setHeader>
<camel:to uri="http://localhost:8080/systemB/newOrder?test=testData"
/>
</camel:route>
)来实现:
Ctrl+Shift+J
只要您知道CSS文件的绝对网址,就可以将// load the disk cache
var cacheservice = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
var {LoadContextInfo} = Components.utils.import("resource://gre/modules/LoadContextInfo.jsm",{})
var hdcache = cacheservice.diskCacheStorage(LoadContextInfo.default, true);
// compose the URL and submit it for dooming
var uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService).newURI(prompt("Enter the URL to kick out:"), null, null);
hdcache.asyncDoomURI(uri, null, null);
替换为网址。
改编自DoomEntry.js,确认也适用于最新的Firefox(Quantum)。