📜  localstorage try catch - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:21.683000             🧑  作者: Mango

代码示例1
try {
  localStorage.setItem(key, value);
} catch(e) {
  if (e.code == 22) {
    // Storage full, maybe notify user or do some clean-up
  }
}