GuidesWeb Storage API vs. Cookies for Browser Data Storage

Web Storage API vs. Cookies for Browser Data Storage

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

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.



Read the full story at WebReference:


Web Storage API: More Security, Efficiency and Capacity than Cookies

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories