Storing Data With HTML5

Storing data with HTML5 is one of the new things to come out of this new version of html. It allows a browser to work much like a downloaded app would operate. Read on to find out more about the browser storage capabilities coming up in the near future.

 

 

 

For the longest time, webmasters have thought that the only local storage they could put on a browser was a cookie. Not so. Internet Explorer Six, believe it or not, had a working model of local storage from ten years ago. No, they did not have an HTML5 setup, but they had the right idea. Microsoft called it “userdata” and each domain visited would have a set amount of local storage assigned to it based on user preferences. Fast forward to now, and the idea ( the element ) in HTML5 is aptly named; “localStorage”.

 

 

 

Not all browsers are yet equipped to handle the localStorage element ( tag ), but they are coming along nicely. Firefox version 3.5 and up support this element. Mobile Safari supports it, as well as Internet Explorer 8 and upcoming version 9. If a browser is not going to support the localStorage, such as earlier Opera versions, the cookie option is still going to be available. A cookie can be used in a limited scenario where not much storage space ( 4096 bytes ) is going to be used. It can not be thought of as permanent, since computers have software, and sometimes users, that delete cookies. The localStorage element is much more robust and supports large arrays ( databases ) of information.

 

 

 

The localStorage is for data that is intended to be left on the browser indefinitely. For example, upon the first visit to a website, the visitor can enter their name into a small form. During future visits, their name can be displayed on the same website over and over without a need for asking. There are other examples, such as the ability to detect the presence ( or lack thereof ) of a network cable. The HTML5 localStorage application can then change a blog from functioning online to functioning locally.

 

 

 

Some developers have sneakily been creating HTML5 apps that copy what downloaded apps do. All the graphics, CSS, javascript and what not are are installed in localStorage to function and look like a piece of software. The type of device accessing the page is not important, just the browser. If the browser is HTML5 compliant, everything runs as designed, since it is in the browser, not on the computer memory. This could be thought of as “write once, run anywhere”. If that phrase sounds familiar, it came from the programming language called Java. All the tools are there already in HTML5, the only thing holding back HTML5 apps are the browser manufacturers. Microsoft is said to be creating a winner in IE9.

 

 

 

 

The localStorage element is accompanied sometimes by a “sessionStorage” tag that does what it’s namesake says. It is a temporary way to store data in the browser, as opposed to the permanent one; localStorage. An important new aspect for web developers to be thinking about is HTML5 security using these new tags, but that is another topic for a later day.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay