How to delete indexedDB?

后端 未结 17 2042
忘了有多久
忘了有多久 2020-12-02 05:16

I\'m working in a project which involves using IndexedDB. As I\'m begining to know this technology, I need to be able to delete an indexedDB by hand so I can start over.

相关标签:
17条回答
  • 2020-12-02 06:08

    Alternatively, use your web application in a new incognito window, and close it when you're done: database deleted.

    0 讨论(0)
  • In chrome OSX- /Users/user/Library/Application Support/Google/Chrome/Default/IndexedDB Firefox OSX - Users/user/Library/Application Support/Firefox/Profiles/4zaemxcn.default/indexedDB

    You just need to make visible the library folder. All of the files are stored in folders(which are called as domain name) and the files use hash, but you can figure out the name of database from it. You can delete data from IDB because it is a client side database and all of the data is stored locally.

    0 讨论(0)
  • 2020-12-02 06:10

    It's not possible to delete IndexedDB database (as opposed to stores and indexes) programmatically.

    As for manual workarounds, this post details the location of the database on Windows systems for Firefox and Chrome.

    Update: Thanks to developer Joshua Bell, Chrome implements an off-spec (but insanely useful) deleteDatabase method on the window.indexedDB object. Here's the crbug that landed this patch. Moreover, in newer versions of IE, you can delete databases via a settings panel.

    0 讨论(0)
  • 2020-12-02 06:10

    I needed to get rid of an indexedDB in Chrome. So I search for this lousy thing called "email assistant" on my computer using MasterSeeker. Found the thing in a bunch folders that were indexedDB in Chrome. It seemed too easy that I just delete those files. I looked up how, and ended up here. I went to chrome settings with my Windows 10 PC. I just gave it a shot at trying to clear the browsing data. Presto - all those files disappeared from indexedDB, including that dreaded "email assistant" crapola. Now when I look in the indexedDB folder all I see that has reappeared is https_mail.google.com_0.indexeddb.leveldb - which looks like a safe non-irritating thing.

    0 讨论(0)
  • 2020-12-02 06:11

    This is maybe overkill for your specific question, but I kept ending up here in my struggle to delete my idb.

    My solution in the end was based on mozilla's documentation, but required that I first close the database.

    For me, in Javascript, the code looked like this:

    my_db_instance.close(function(e){console.log(e)});
    var DBDeleteRequest = indexedDB.deleteDatabase("my_db_name");
    
    // When i had the base open, the closure was blocked, so i left this here
    DBDeleteRequest.onblocked = function(event) {
      console.log("Blocked");
    };
    
    DBDeleteRequest.onerror = function(event) {
        console.log("Error deleting database.");
      console.log(event);
    };
    
    DBDeleteRequest.onsuccess = function(event) {
      console.log("Database deleted successfully");
    };
    
    0 讨论(0)
  • 2020-12-02 06:14

    To remove all Chrome IndexedDB databases run the following in OSX terminal emulator.

    rm -rf ${HOME}/Library/Application\ Support/Google/Chrome/Default/IndexedDB/*
    

    Now restart your browser and that's it.


    Because I need to purge IndexedDB databases very often, I have set up an alias in my ~./bash_profile.

    alias purge-idb="rm -rf ${HOME}/Library/Application\ Support/Google/Chrome/Default/IndexedDB/*"
    
    0 讨论(0)
提交回复
热议问题