[Vuejs]-Why localstorage is not working firefox 57 and Vuejs2?

1๐Ÿ‘

Did you try window.localStorage? This should be context- and scope-unreliant.

0๐Ÿ‘

try to

  1. delete the local storage for this site in settings. URL=about:preferences#privacy
  2. close FF
  3. restart FF

it worked in my case โ€“ I had updated to version 57 โ€“ somehow my profile got corrupted
in Windows the FF profile is located at:
C:\Users[youraccountname]\AppData\Local\Mozilla\Firefox\Profiles\

0๐Ÿ‘

I had to change my code to solve the problem . The problem is when the LocalStorage is inside of an axios http response (setLanguage method) It works in Chrome but in firefox LocalStorage is empty. when i move the LocalStorage outside the response it works.

<script>  
import  'vue-awesome/icons';
import {HTTP} from '../common/http-common';  
export default {
    props:['topNavbarOptions'],
    data: function () {
        return {
            menuclicked: false,
            locale:'en'

        }
    },
    mounted:function(){

      if(localStorage.getItem("locale"))
        {
          this.locale = localStorage.getItem("locale");
        }
           this.$i18n.set(this.locale);

   },
    methods: {
        OpenMenu: function (menuclicked) {
            this.menuclicked = !menuclicked;
            this.$emit('openmenu', this.menuclicked );
        },
        setLanguage:function(localecode)
       {  
          //Set front end locale
         localStorage.setItem("locale",localecode); 
          //Set backend locale
          HTTP.get('lang/'+localecode)
          .then(response =>{

          })
          .catch(error=>{
          console.log(error);
          });

        }



    }

}
</script>

-1๐Ÿ‘

Try this:

browser.storage.local.get() โ€“ to retrive data
browser.storage.local.set() โ€“ to post data

Leave a comment