Skip to content

Use Chrome Extension API within Vue.js Component

I’m trying to access the local storage of the chrome extension ergo the chrome browser within my vue.js component.


        <server-list :server-descriptions="serverDescriptions"/>

      import ServerList from "./ServerList.vue"{'foo': 'hello', 'bar': 'hi'}, function() {
        console.log('Settings saved');
      });['foo', 'bar'], function(items) {
        console.log('Settings retrieved', items);


This code is within my popup.html and this is what the console of the popup.html inspection tells me this: enter image description here

Therefore I assumed it did work. But when I check the local storage through the debugger tab I see nothing:enter image description here

Even checking localStorage in the console manually does not show me anything: enter image description here

Therefore I assume the data is not persistet in my chrome browser?

Does anybody know how I can get this to work? Or give me a hint?


Answer api and localStorage api both are different things. api has been optimized to meet the specific storage needs of extensions. It provides the same storage capabilities as the localStorage API. There are many difference between this two like the localStorage API stores data in strings where as storage api can be stored as objects and It’s asynchronous with bulk read and write operations so, it is faster than localStorage api. If you want to store in localStorage api. You can do it by,

localStorage.myvar = "This is an example";


localStorage.setItem("myvar", "This is an example");

You can get item by


Remove item like


you can access this variable using localStorage.myvar. Hope it helps

User contributions licensed under: CC BY-SA
8 People found this is helpful