Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML5 Local Storage

 
Albareto McKenzie
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

Html 5 look really promising and have a lot of cool features for developers, reading a bit about it I came across the Local Storage, I read that is is a much better way to store data than Cookies. I have a couple of questions about it, there they go:

How does the Storage store the information? I mean, is it a physical file in the system like Cookies were?
What does it make it better than Cookies?
Is it possible to delete this data? This question goes in both directions as developer and user, I mean, is it possible to programatically delete the data and as a user can I delete local data as I am able with individual cookies?

Thanks for coming here to help us out

Cheers
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main advantage local storage has over cookies is that the data doesn't get sent along with each HTTP request and response, saving you many bytes in network load and improving performance. How local storage is implemented depends on the browser, Firefox sticks them all into a SQLite database as far as I'm aware. As a user, a browser should provide an interface to clear stored data for any particular site. As a developer, there's a removeItem method.
 
paul nisset
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

I saw this response about local data in HTML5 and was kind of surprised at how it works.


Firefox sticks them all into a SQLite database as far as I'm aware.


This seems quite alarming in terms of performance .
Is is really quicker for a browser to open a database and run a query to access site specific data than to set and read a cookie ?

Thanks,
Paul
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt it, Firefox stores nearly everything in SQLite databases, including cookies I think. If filesytems were faster than databases, what would be the point of databases?

At this point I should make sure you're aware: I'm not an expert in writing browsers, or even filesystems vs databases, so someone could come along and point out I'm wrong any minute, but this is the impression I got from different defects I glanced through in Bugzilla over recent years. Mozilla have been pushing a lot of their stuff into SQLite instead of using custom storage solutions.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems like an assumption without any basis in fact. Is there any evidence to support performance concerns with the use of SQLLite by Firefox?
 
paul nisset
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how Firefox uses SqlLite . If it automatically opens up a database every time it starts, then writing to a database that is already in memory would be quicker than disk I/O.
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now that I'm no longer replying on my phone, here's a ls *.sqlite of my Firefox profile:



Cookies are there on line 5, local storage data is in webappsstore.sqlite.
 
Albareto McKenzie
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob for the replies and the others for adding info-discussion.

Cheers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic