-_-#QUOTA_EXCEEDED_ERR: DOM Exception 22

1399 ワード

iOSのSafariはインデントなしモードでsessionStorage操作に異常が発生し、QUOTA_EXCEEDED_ERR: DOM Exception 22.
html5 localStorage error with Safari: “QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota.”
function isLocalStorageNameSupported() {

  var testKey = 'test', storage = window.sessionStorage;

  try {

    storage.setItem(testKey, '1');

    storage.removeItem(testKey);

    return true;

  } catch (error) {

    return false;

  }

}

デバッグ
try {} catch(error) {alert(error)}