// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem // throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem // to avoid the entire page breaking, without having to do a check at each usage of Storage. 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('Your web browser does not support storing settings locally. In Safari, the most common cause of this is using "Private Browsing Mode". Some settings may not save or some features may not work properly for you.'); } }
可以酱紫判断。提示用户关闭无痕模式。
或者http://stackoverflow.com/questions/14555347/html5-localstorage-error-with-safari-quota-exceeded-err-dom-exception-22-an这里还有其他
人写的一些方法,我没试过。各位可以试试
iOS Safari无痕模式下Vue项目登录问题
本文介绍了一个使用Vue开发的应用在iOS Safari无痕模式下登录功能失效的问题及解决方案。通过检测localStorage是否可用并提示用户关闭无痕模式,可以解决此问题。

4147

被折叠的 条评论
为什么被折叠?



