localstorage 在各个浏览器下面的坑

首先看下兼容性

155032_MVWq_1037170.png

在看下存在的坑:

  • Storing large amounts of data in Safari (on OSX & iOS) can result in freezing the browser

(存储大量的数据在 safari中,会导致浏览器崩溃的)

 

  • IE10 in Windows 8 has an issue where localStorage can fail with the error message "SCRIPT5: Access is denied" if "integrity" settings are not set correctly. see details

(在win8 的IE10 中有一个问题: 如果设置不正确的话的话 localstorage会抛出一个异常错误:SCRIPT5: Access is denied)

 

  • The "storage" event is completely wrong in IE: (IE里面的错误)

IE10 : The storage event is fired even on the originating document where it occurred. Causes problems with multiple windows websites, and huge problems with iframes.

(存储事件触发即使在原始文档发生。导致多个窗口网站问题,和巨大的iframes的问题)

 

IE11 : The storage event's oldValue and newValue are identical (newValue is supposed to contain the storage's updated value).

(存储事件的oldValue和newValue是相同的(newValue应该包含存储的更新值))

 

Partial workaround: regularly probe the storage's value and compare with the last known value on all pages where you want to listen to this event, and track the last submitted value to determine if the modification was triggered locally.

(部分处理:定期调查存储的值,与去年相比已知值在所有页面,你想听这个事件,并跟踪最后提交的值来确定是否在本地修改被触发。)

  • Internet Explorer does not support storing most of the ASCII characters with codes under x20.

(Internet Explorer不支持存储ASCII字符与编码x20。)

 

  • In IE attempting to access localStorage on HTML files served from the file system results in the localStorage object being undefined

(在IE中试图访问localStorage HTML文件从文件系统服务结果在localStorage对象被定义)

 

  • In iOS 5 & 6 localStorage data is stored in a location that may occasionally be cleared out by the OS.

(在iOS 5 & 6 localStorage数据存储在一个位置,偶尔会被清除的操作系统。)

 

  • In private browsing mode, Safari and iOS Safari up to including version 10.x as well as the Android browser (not include Chrome for Android) do not support setting sessionStorage or localStorage.

(在隐私浏览模式下,Safari和iOS Safari包括版本10。x以及Android浏览器(不包括铬为Android)不支持设置sessionStorage或localStorage。)

 

  • IE 8 and 9 store data based only on hostname, ignoring the scheme (http vs https) and port number as required by the specification.

(IE 8和9只基于主机名存储数据,忽略了方案(http和https)和端口号的要求规范。)

 

  • IE11 does not properly synchronize localStorage between different windows.

(IE11不正确同步localStorage不同窗口)

转载于:https://my.oschina.net/bosscheng/blog/1586389

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值