Use Cookie or Localstorage?

Asked

Viewed 581 times

3

I was developing a plugin for jQuery and needed to store some information.

I thought I’d use the localStorage of HTML5, but I was warned by a friend that in some older versions of browsers would not work, and that I should use Cookies

I took a look at W3school to check this, and there says the following:

Note: Internet Explorer 7 and earlier versions, do not support Web Storage.

That is to say:

Internet Explorer 7 and earlier versions do not support Storage.

  1. I must really worry about still developing for the Internet Explorer 7 or earlier versions?

  2. I can use the secure Torage localthat I won’t have any problems with compatibility with browsers launched in the mid Internet Explorer 9, or should I still wear the good old Cookie?

2 answers

6


I think this depends a lot on the support you intend to give to browsers. If you seek to support as many browsers as possible you could use, or suggest, a pollyfill for Webstorage.

In the link follows a list of available pollyfills:

https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills

I would particularly choose to use Webstorage, because the trend is that browsers are updated over the years and IE 7 is already quite old, although it is still widely used I would choose not to support it.

  • Usually, in the systems I develop, I worry about the IE 10 up

2

  1. I must really worry about still developing for the Internet Explorer 7 or earlier versions?

    This will depend on whether you intend to support older browsers, particularly I believe that it is not necessary to support browsers with versions prior to IE7, Firefox 3.5, because should not have many users, here you can see some statistics on the most used browsers.

  2. I can use the localStorage safe that I will not have compatibility problems with the browsers released in the middle of Internet Explorer 9, or should I still use the good old Cookie?

    You can use localStorage no problems in modern versions, here you can see in which browsers it is supported.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.