All websites currently use cookies to store client-related data, and while cookies are definitely a good method for storing client-related information, they are not always efficient. The Web Storage API, first introduced as a part of HTML5 and now developed as a separate standard by the W3C, is a more secure, efficient and higher capacity option.
In fact, using a cookie to store data often becomes a challenge to avoid race conditions. Also, the cookie data available for a typical website is a lot smaller than Web storage’s 5MB or 10MB, depending upon the browser. Web storage also offers a more secure method for storing client-related information. Unlike a cookie, Web storage data is not carried over to the server via HTTP. So Web storage data can be accessed only via client-side scripts. This means the server cannot read or write directly to Web storage.
In his WebReference article, Sachin Khosla introduces the Web Storage API and explains how it enables storing data in a more secure and efficient way than cookies.