ie localStorage 兼容问题
2016-07-01 11:43
225 查看
参考方案来自https://connect.microsoft.com/IE/feedback/details/812563/ie-11-local-storage-synchronization-issues
原文如下:
详细信息
建议 (12) | 解决方法 (4) | Attachments (5)
由 AlexandreJobin 在 2016/2/16 7:48 发送
I confirm that the @Vageesh Dwivedi solution works for me. Each time i have to write new data to the localStorage, i also create a dummy item and remove it right away and my tabs are
now synced.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
由 Kiyokura 在 2015/4/27 17:29 发送
I found a workaround (IE11 on Win8.1).
Add the following code, update of other tabs is synchronized well:
----
window.addEventListener("storage", function (e) {
// Dummy
}, false);
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
由 Vageesh Dwivedi 在 2015/3/4 6:14 发送
I also faced a similar issue.
Scenario : window 1 is domain.com and has an iframe of domainx.com, window 2 is domainx.com. I wanted localstorage based communication between window 1's iframe and window 2.
The listener and polling technique didn't work and indexedDB workaround was too big for this small problem. After a few hacks, the localStorage keys were synced when i did -
localStorage.setItem('dummy', 'dummyvalue');
localStorage.removeItem('dummy');
in iframe on window 1.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
由 WalkMe 在 2014/2/5 4:03 发送
As a workaround we used indexed DB instead of local storage.
The indexed DB synchronizes well, but it is async compared to the local storage which is sync.
To overcome this difference we used web workers and gave them the job of writing the data, so it was done almost in parallel.
Still prefer an official solution :)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
我的方法:
我的解决方案取自上文的前两种方法,即使用增加和移除虚假的item更新localStorage,同时定义使用window.addEventListener("storage",function(e){ // Dummy },false);
1、当然可以单独使用第二种方法,测试有效
2、单纯使用第一种方法不能保证在所有情况下都有效。但结合第二种方法后,会好很多
原文如下:
IE 11 - Local Storage - Synchronization issues - by WalkMe
状态 :
|
描述
While working with two IE 11 windows, in each an iframe of the same domain, values stored in one iframe (using local storage) are not synchronized to the other iframe. This in contradiction to the specification (other browser act correctly).
详细信息
建议 (12) | 解决方法 (4) | Attachments (5)
由 AlexandreJobin 在 2016/2/16 7:48 发送
I confirm that the @Vageesh Dwivedi solution works for me. Each time i have to write new data to the localStorage, i also create a dummy item and remove it right away and my tabs are
now synced.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
由 Kiyokura 在 2015/4/27 17:29 发送
I found a workaround (IE11 on Win8.1).
Add the following code, update of other tabs is synchronized well:
----
window.addEventListener("storage", function (e) {
// Dummy
}, false);
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
由 Vageesh Dwivedi 在 2015/3/4 6:14 发送
I also faced a similar issue.
Scenario : window 1 is domain.com and has an iframe of domainx.com, window 2 is domainx.com. I wanted localstorage based communication between window 1's iframe and window 2.
The listener and polling technique didn't work and indexedDB workaround was too big for this small problem. After a few hacks, the localStorage keys were synced when i did -
localStorage.setItem('dummy', 'dummyvalue');
localStorage.removeItem('dummy');
in iframe on window 1.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
由 WalkMe 在 2014/2/5 4:03 发送
As a workaround we used indexed DB instead of local storage.
The indexed DB synchronizes well, but it is async compared to the local storage which is sync.
To overcome this difference we used web workers and gave them the job of writing the data, so it was done almost in parallel.
Still prefer an official solution :)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
我的方法:
我的解决方案取自上文的前两种方法,即使用增加和移除虚假的item更新localStorage,同时定义使用window.addEventListener("storage",function(e){ // Dummy },false);
1、当然可以单独使用第二种方法,测试有效
2、单纯使用第一种方法不能保证在所有情况下都有效。但结合第二种方法后,会好很多
相关文章推荐
- 控制台 覆盖刷新
- http://blog.csdn.net/lmj623565791/article/details/51635533
- Swift语言编写一个简单的条形码扫描APP
- Android 异常java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- Java编程题目-2:WebService简单实现
- 对SQL Server DB 进行checkdb
- linux下测试某网址或IP端口能否访问
- android 7.1 输入动态匹配
- JAVA线程池ThreadPoolExecutor与阻塞队列BlockingQueue
- Kettle
- PHP领域类型Java中ibatis的API
- 读《圈子圈套》有感
- unity 优化3-内存优化
- My remote working experience
- Android自定义ListView实现侧滑子菜单
- 解决 01-Jul-2016 10:49:05.875 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.mysql.jdbc.D
- css3.0 动画在线演示工具 对于初学者不妨看看
- iframe学习总结
- android 百度地图系列之添加覆盖物和覆盖物的点击事件
- unity 优化2