Local Storage vs Cookies

后端 未结 7 1473
名媛妹妹
名媛妹妹 2020-11-21 11:04

I want to reduce load times on my websites by moving all cookies into local storage since they seem to have the same functionality. Are there any pros/cons (especially perfo

7条回答
  •  名媛妹妹
    2020-11-21 11:52

    It is also worth mentioning that localStorage cannot be used when users browse in "private" mode in some versions of mobile Safari.

    Quoted from MDN (https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage):

    Note: Starting with iOS 5.1, Safari Mobile stores localStorage data in the cache folder, which is subject to occasional clean up, at the behest of the OS, typically if space is short. Safari Mobile's Private Browsing mode also prevents writing to localStorage entirely.

提交回复
热议问题