I am trying to write a simple chrome extension using html5 local storage. I use one index variable, which is automatically incremented every time a new value is added to local storage.
But when I load the action of the Chrome browser, it initializes this variable to 0.
Can we declare any variable only once in browser action.
PS I'm new to chromium
Thank you in advance
, popup.html, . , , , , .
popup.html
Backgorund →
localStorage.
: ,
var counter = 0; function incCounter(){ window.counter++; }
popup.html :
var bgp = chrome.extension.getBackgroundPage(); bgp.incCounter();