Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do all browsers have local storage?

I wanted to know if it's necessary to do a check if local storage is present or not when I try to use it.

Ie, I have this as a check:

  if (global.localStorage) {
    global.localStorage.setItem('layout', JSON.stringify({
      [key]: value
    }));
  }

Or can I use localStorage without this check?

like image 294
reectrix Avatar asked Aug 17 '16 20:08

reectrix


People also ask

How do I know if my browser supports local storage?

localStorage browser support To be sure the browser supports localStorage , you can check using the following snippet: if (typeof(Storage) !== "undefined") { // Code for localStorage } else { // No web storage Support. }

Does Chrome support local storage?

Google Chrome/ChromiumChrome treats cookies and local storage as the same thing, so these steps work for both. Click on the menu button in the top-right corner of your Chrome window. Select “Settings” from that menu. Click “Cookies and site permissions”.

How do I get local storage on my browser?

Just go to the developer tools by pressing F12 , then go to the Application tab. In the Storage section expand Local Storage. After that, you'll see all your browser's local storage there. In Chrome version 65, you can manually modify and add new items.


2 Answers

Mozilla maintain a table of desktop and mobile browser support here: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

enter image description here

like image 117
Alex S Avatar answered Nov 20 '22 01:11

Alex S


You can see the full list of supported browsers here

like image 39
user3746240 Avatar answered Nov 20 '22 00:11

user3746240