Is it possible to delete a specific file from the firefox cache?

I am developing an ASP.net application.

Where I need to update my CSS file often. I do not want to update the document frequency setting from about:configin Firefox. I want it by default.

I use Firefox as a perfect browser. If I just update my CSS file, I have to clear all Firefox cache.

I want to delete a specific file from the Firefox cache. Is this possible in Firefox. I can delete a specific cookie in Firefox. Can't delete a specific file from the Firefox cache?

If this is not possible, tell me how I can make my CSS file so that it is always checked (and only loaded if changed) for a newer version. I do not want to change Firefox settings anyway.

+5
source share
4 answers

If I remember correctly, keycombination CTRL + F5 clears the cache and the css files must be reloaded.

+2
source

Using an ETag would be a good option. By installing Max-Age Header in HTTP responses, you can allow the client to cache the resource for a limited time. After this time, the client will execute a conditional GET request to the server. If the ETag (stored in the If-None-Match header) in the request does not match the ETag on the server, the changed resource will be sent to the client. Otherwise, the server responds with HTTP 304 Not Modified, and the client can cache the content again for a limited time. This approach can be used for specific files or directories.

+1
source

. , php

<link type="text/css" rel="stylesheet" href="css/style.css?lu=<?php echo filectime('css/style.css') ?>" />

This will force the browser to reload the file only after updating the file.

+1
source

This is possible through a few lines of script (to run in the browser console, Ctrl+Shift+J):

// 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);

As long as you know the absolute URL of the CSS file, you can replace it prompt("Enter the URL to kick out:")with a URL.

Adapted from DoomEntry.js , confirmed to work with the latest Firefox (Quantum).

+1
source

All Articles