Skip to content Skip to sidebar Skip to footer

Google Chrome Extension -- Chrome.storage.sync.get Not Working

Just wondering if anyone can see anything wrong with my code, the saving of the data works fine, however when I try to load it, it cannot find the saved data: Code: $('#SaveSet').

Solution 1:

I believe that chrome.storage.sync.get will always return to you an object, even if you're only asking for the value of a single key.

That would mean that instead of your data parameter being just the value, it is actually an object, with a single key named 'ToSave'.

Try this for your #Get handler:

$('#Get').click(function() {
    alert('working');
    chrome.storage.sync.get("ToSave", function(data) {
        alert("data: " + data.ToSave);
    });
});

Post a Comment for "Google Chrome Extension -- Chrome.storage.sync.get Not Working"