Can I delete particular file from firefox cache?

前端 未结 4 1114
忘了有多久
忘了有多久 2021-01-18 08:13

I am developing an ASP.net application.

Where I have to frequently update my CSS file. I don\'t want to update document frequency setting in from about:config<

4条回答
  •  轮回少年
    2021-01-18 08:48

    This is possible via a few lines of script (to be run on 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 could replace prompt("Enter the URL to kick out:") with the URL.

    Adapted from DoomEntry.js, confirmed to work on latest Firefox (Quantum) as well.

提交回复
热议问题