博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
localstorage 在各个浏览器下面的坑
阅读量:7018 次
发布时间:2019-06-28

本文共 2226 字,大约阅读时间需要 7 分钟。

hot3.png

首先看下兼容性

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

你可能感兴趣的文章
【“零起点”--百度地图手机SDK】如何查询从西单到王府井的公交导航?
查看>>
Newtonsoft.Json高级用法
查看>>
Spring boot 注解简单备忘
查看>>
PHP5.6.x的新鲜事
查看>>
[改善Java代码]不要在构造函数中抛出异常
查看>>
Strom的trident小例子
查看>>
mysql-5.6.23-winx64.zip版本安装记录
查看>>
Cfree clion windows c语言 socket 网络编程
查看>>
maven国内aliyun镜像
查看>>
结对项目-地铁出行路线规划程序(续)
查看>>
洛谷——P1062 数列
查看>>
并发的执行策略
查看>>
netstat和ss
查看>>
C# PictureBox加载图片并显示进度条
查看>>
C#编码好习惯(转载)
查看>>
Xcode导入第三方库
查看>>
机器学习-资源链接
查看>>
Redis持久化机制
查看>>
MongoDB基础命令
查看>>
【DP】HDU 1176
查看>>