google chrome - passing data from contentscripts.js to popup.js via storage local -
i'm still busy first extension. want pass on data (an array) contentscripts.js popup.js. read in several sources easiest way using local storage.
this tried:
contentscripts.js (i don't know if 1 works)
... alert(isotopeindices[0]); // array isotopeindices has lots entries chrome.storage.local.set(isotopeindices[0]); //goal save whole array: chrome.storage.local.set(isotopeindices);
popup.js
chrome.storage.local.get( function(isotopeindices) { document.getelementbyid('selectisotopes').innerhtml = isotopeindices[0]; } );
my popup shows in <div id="selectisotopes">...</div>
-element undefined. why think chrome.storage.local.set
doesn't work @ all. concerning google-howto (http://developer.chrome.com/extensions/storage.html) should correct.
even though question is, local storage simplest way pass data...?
thanks time , help!!!
Comments
Post a Comment