IOS下localstorage不起作用提示

if (typeof localStorage === 'object') {
    try {
        localStorage.setItem('localStorage', 1);
        localStorage.removeItem('localStorage');
    } catch (e) {
        Storage.prototype._setItem = Storage.prototype.setItem;
        Storage.prototype.setItem = function() {};
        alert('您处于无痕浏览,无法为您保存');
    }
}

你可能感兴趣的:(localstorage)