How Can I Keep The Value Of Variable After Reload Browser In Chrome Extensions
I am writing my first chrome extension and I am kind of new in this field. My goal is sending url and email to a PHP server, but for now I send them to console. My problem is savin
Solution 1:
My codes to save a variable and to load a variable:
// Saving
chrome.storage.sync.set({"variableName": value});
// Loading 1 thing
chrome.storage.sync.get("variableName", function(result){
// Showing the requested variable value
alert(result.variableName);
});
// Loading more things
chrome.storage.sync.get(["variableName", "variableNameTheSecond"], function(result){
// Showing first the first one and then the second one
alert(result.variablename);
alert(result.variableNameTheSecond);
});
I hope this helps you, greets
Ebbe
Post a Comment for "How Can I Keep The Value Of Variable After Reload Browser In Chrome Extensions"