Question

I see that Web Storage is also called DOM storage. When interacting with Web SQL and indexedDB via JS am I interacting with the DOM or something else?

Was it helpful?

Solution

Web storage (also known as DOM storage) is a very basic key/value store offered as a feature of "HTML5". I would guess it became known as DOM storage as it was the first browser storage whose API is in the window, like the DOM (i.e. window.localStorage). (that guess is wrong, see edit below)

If you're looking to persist data more complex than key/values then you have the options of, as mentioned, WebDb and WebSimpleDb (now known as IndexedDb), both web SQL.

So Web Storage and WebSQL are distinct concepts, neither of which actually persist data to the DOM.

http://diveintohtml5.info/storage.html

Edit: just found this

As it happens, Mozilla’s internal name of this features is “DOMStorage” (the names “Storage”, “mozStorage”, and “sessionStorage” were all already in use), I’m beginning to suspect that this naming confusion has stemmed from this, original, feature-naming. (Note: This has been confirmed.)

http://ejohn.org/blog/dom-storage-answers/

TL;DR Web storage has nothing at all to do with the DOM and only got that name due to internal Mozilla naming conflicts.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top