How to delete indexedDB?

后端 未结 17 2104
忘了有多久
忘了有多久 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:00

    In order to complete @Judson's answer, based on @fullstacklife's comment; for deleting IndexedDB in chrome using javascript you should:

    let currentIDB = indexedDB.open("DB_NAME", DB_VERSION_INTEGER);
        currentIDB.onblocked = function(){
            //
        };
        currentIDB.onerror = function(){
            //
        };
        currentIDB.onsuccess = function(){
            var idb = currentIDB.result;
            idb.close();
            indexedDB.deleteDatabase("DB_NAME");
        };
    

提交回复
热议问题