localstorage 在各個瀏覽器下面的坑

首先看下兼容性web

在看下存在的坑:windows

  • 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)session

 

  • 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.ide

(存儲事件觸發即便在原始文檔發生。致使多個窗口網站問題,和巨大的iframes的問題)網站

 

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

(存儲事件的oldValue和newValue是相同的(newValue應該包含存儲的更新值))this

 

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不一樣窗口)

相關文章
相關標籤/搜索