code: function checkIfLocalStorageThrows() {
      var localStorageTestKey = '_localforage_support_test';
  
      try {
          localStorage.setItem(localStorageTestKey, true);
          localStorage.removeItem(localStorageTestKey);
  
          return false;
      } catch (e) {
          return true;
      }
  }
docs: Check if localStorage throws when saving an item