Will localstorage automatically fall to cookies in old browser?

It is said that localstorage only supported by browsers newer than this:

  • IE 8
  • Firefox 3.5
  • Safari 4
  • Chrome 4
  • Opera 10.5
  • iOS 2.0
  • Android 2.0
  • So, if I my clients will use older browser - is it OK for me to store some information (less than 4kb) still in localstorage via jquery?

    Also, which mobile browsers support localstorage?


    Just do a simple test to see if it's supported:

    if(localStorage in window)
        //localstorage supported
    

    or simply

    if(localStorage)
        //localstorage supported
    

    It won't help if you use a jQuery plugin. It will still boil down to whether if it's supported by the browser or not.


    NO. The old browsers don't know what to do with local storage. Local storage was initially defined as part of the HTML5 standard but now has been moved to a different one.

    What you can do is use something like PersistJs and/or use a feature detection library (read Modernizr).


    Okay, Okay, guys:) My question was mostly about 'will jquery automatically store data in cookies if there are no localstorage'. So, it turns out that it will not becouse it is very different mechanisms.

    Also, according to this:

    Local storage is available on all the modern appphones and has been for a while. 
    
    iOS 3.2 and above
    Android 2.1 and above
    RIM OS 6 and above
    
    It's NOT available on Windows Phone 7 or Opera Mini (since it's not a real local browser)
    

    And there are the code to automatically choose supported storage for your data.

    链接地址: http://www.djcxy.com/p/89976.html

    上一篇: jPlayer在iOS iPhone上无法正常工作

    下一篇: 本地存储会在旧浏览器中自动下载到cookie中吗?