Is it possible to clear “offline website data” programmatically?

As known, “Offline Website Data” can be cleared as follows from the browser:

20240624-210211

I want to do the same thing but programmatically, I tried to do that but there is no option to clear the “offline website data”:

browser.browsingData.remove({ }, {
    "cookies": true,
    "history": true,
    "downloads": true,
    "cache": true,
    "formData": true,
}).then(() => {
    console.log("data have been cleared.")
});

Is it possible to clear the “Offline Website Data” through web extension development?

You are correct, browsingData.DataTypeSet doesn’t have an “offlineWebsiteData” value.
Offline Website Data is probably a combination of several browsingData.DataTypeSet values.
(regular Firefox users don’t need the fine-grained control offered by browser.browsingData.remove())

The question is:
Which Web APIs save data that falls under Offline Website Data?

A quick Web search for “firefox Offline Website Data” finds Difference between Cookies, Cache, Site Settings and Offline Website Data?

So it looks like Offline Website Data is:

  • indexedDB
  • localStorage
  • and maybe others, like serviceWorkers

Hopefully someone from Mozilla knows more :slight_smile:

Thanks, I tried to do the following:

browser.browsingData.remove({ }, {
    "cookies": true,
    "history": true,
    "downloads": true,
    "cache": true,
    "formData": true,
    "passwords": true,
    "localStorage": true,
    "indexedDB": true,
    "serviceWorkers": true,
    "pluginData": true,
    "serverBoundCertificates": true,
}).then(() => {
    console.log("data have been cleared.")
});

But it clears everything except for the “Offline Website Data”.

I dug through Firefox source and double checked with an engineer and, unfortunately, it doesn’t look like there’s a direct equivalent to the “Offline website data” settings in the Browsing Data API.

@LionKing, could you open a bug report on bugzil.la and include a minimal reproduction extension that shows that you can’t clear offline website data?