Good day, all
I read on this page [Using IndexedDB]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB
that browser will prompt user to give permission to create indexedDB, and the user may deny permission. See quote below:
The most likely problem is that the user decided not to give your web app permission to create a database. One of the main design goals of IndexedDB is to allow large amounts of data to be stored for offline use. (To learn more about how much storage you can have for each browser, see Storage limits.)
Obviously, browsers do not want to allow some advertising network or malicious website to pollute your computer, so browsers prompt the user the first time any given web app attempts to open an IndexedDB for storage. The user can choose to allow or deny access.
However, when testing on my localhost, neither Firefox nor Google Chrome asked me for permission. And the db was created successfully (it seems.)
So, is that article outdated? Or is it because I'm testing on localhost? or something else I'm missing?
Kind Regards
Note: IndexedDB can be used inside a service worker for data storage if you require it.
Why to use indexeddb? The W3C has announced that the Web SQL database is a deprecated local storage specification so web developer should not use this technology any more. indexeddb is an alternative for web SQL data base and more effective than older technologies.
Data stored in indexedDB is available to all tabs from within the same origin.
If you want to store structured data on the client side, IndexedDB is the better choice, especially since localStorage isn't built to store sensitive information. But if you're storing a simple, small amount of key-value pair data, use localStorage.
The article is outdated. Depending on how you use IndexedDB, you might never get a prompt, but it depends on the browser and that could change in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With