localStorage and Cordova

  • Goodday,

    I use localStorage in my Quasar app for mobile via Quasar Wrapper for webstorage. The wrapper is used inside vue files as
    this.$q.sessionStorage.set(key, value).
    In desktop broswers the app works flawlessly and localStorage works as it should for saving\retrieving data. However, it doesn’t work on Genymotion emulator and when I install the application on a mobile device using Cordova. I ran this simple code inside my quasar code recommened for testing webstorage:

    if (typeof(Storage) !== “undefined”) {
    // Code for localStorage/sessionStorage.
    } else {
    // Sorry! No Web Storage support…

    The code detects webstorage on both Genymotion and mobile device. Maybe Cordova+Quasar combination requires additional steps to access localStorage I’m not aware of?

    Thank you!

  • it should still work, cordova just wraps your app in a webView which is like a browser and has access to local/sessionStorage api.

  • Yes, thanks, I can use i like this and it works:

    window.localStorage.setItem(‘settings’, JSON.stringify(this.settings))

    But I found no way to use Quasar wrapper with Cordova which was really convenient.

Log in to reply