HTML5 localstorage in Cordova

前端 未结 2 917
轻奢々
轻奢々 2021-02-01 07:04

Does HTML5 Local Storage work in Cordova / PhoneGap? I am trying to use it, both the HTML5 way and the way specified in the docs. Neither work.

Specifically, I am trying

相关标签:
2条回答
  • 2021-02-01 07:43

    I've used local storage like this:

    // To store a value
    window.localStorage.setItem('key', value);
    
    // To retrieve a value
    value = window.localStorage.getItem('key');
    
    // To delete a storage
    window.localStorage.removeItem('key');
    

    Hope that helps.

    0 讨论(0)
  • 2021-02-01 07:56

    i am using cordova to build an Android app and i am able to save local storage variables with window.localStorage['username'], like:

    window.localStorage['username'] = data.username

    it is like a PHP associative array.

    Hope that helps

    0 讨论(0)
提交回复
热议问题