Google Chrome lists two indexed databases for my own website:
Ursprung: http://www.example.com/
Größe auf Datenträger: 5,5 KB
Zuletzt geändert am: Donnerstag, 9. April 2015 22:23:53
Ursprung: https://www.example.com/
Größe auf Datenträger: 1.048 B
Zuletzt geändert am: Dienstag, 3. März 2015 22:49:21
Regarding my research this is resulted through indexedDB. As I do not know who set this databases and what names they have I tried to find the names and after that delete them as follows:
<script>
indexedDB.webkitGetDatabaseNames().onsuccess = function(sender, args) {
console.log(sender.target.result);
var req = indexedDB.deleteDatabase(sender.target.result);
req.onsuccess = function () {
console.log("Deleted database successfully");
};
req.onerror = function () {
console.log("Couldn't delete database");
};
req.onblocked = function () {
console.log("Couldn't delete database due to the operation being blocked");
};
};
</script>
The console shows Deleted database successfully
but the entry in the Google Chrome website data stays. It only changes in size (between 5 and 10 kB) and the timestamp changes. The console.log
of sender.target.result
returned:
DOMStringList {length: 0, item: function, contains: function}length: 0__proto__: DOMStringList
...
What is wrong and how do I delete both databases through Javascript?
Update 1
Now I tried to create a new database on my own to find out what I need to do to delete it again. Finally this worked (for multiple databases in one step):
<script>
// delete all databases
window.indexedDB.webkitGetDatabaseNames().onsuccess = function(sender, args) {
console.log(sender.target.result);
for (var key in sender.target.result) {
window.indexedDB.deleteDatabase(sender.target.result[ key ]);
}
};
// create a database
//window.indexedDB.open("testDB", 1);
</script>
But after all this testing the Indexed Database filesize in Google Chrome raised to 105 KB:
Größe auf Datenträger: 105 KB
Zuletzt geändert am: Donnerstag, 9. April 2015 23:26:27
It seems that the browser reserves the maximum used database size of the past altough I deleted it. Or is it possible to restore the data?
The next question is why the second database is still unchanged. Is this an other type of database? I really find it scary not having control of something that was created through my website and saved in my visitors browser.