iOS的Safari在無痕模式下,sessionStorage操作產生異常,報錯QUOTA_EXCEEDED_ERR: DOM Exception 22。
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)}