Search code examples
google-chromegoogle-chrome-extension

chrome.storage.sync does not sync across browsers and devices


I am using chrome.storage.sync in an extension to sync data entered in a textarea in a popup.html.

It stores and restores the data correctly locally but it does not sync the data across browsers.

Each browser extension has its own locally entered data available.

The following code is used to save and restore the data:

// Called when the user opens popup.html
$(window).ready(
    function restore() {
        var textarea = document.querySelector("#contacts");
        chrome.storage.sync.get('contacts', function(r) {
            console.log("Contacts retrieved");
            var content = r["contacts"];
            textarea.value = content;
        });
});

// Called when user saves his changes to the textarea
$("#save-button").click(function() {
        var textarea = document.querySelector("#contacts").value;
        var save = {};
        save["contacts"] = textarea;
        // Save data using the Chrome extension storage API.
        chrome.storage.sync.set(save, function() {
            console.log("Contacts saved");
        });
        $("#confirm").text("Contacts saved.").show().fadeOut(5000);
});

In my manifest.json I grant permissions to storage:

    "permissions": [
        "tabs", 
        "http://*/*", 
        "storage"
    ]
}

What is the reason for Chrome Sync not syncing across browsers and devices?


Solution

  • Is your extension uploaded to your Chrome Web Store account and published (or at least published to your testers)?

    Cross-computer sync doesn't work on non-Web Store extensions last I checked, so you have to put it on the Chrome Web Store to test.

    You also have to make sure Extensions is checked under chrome://settings/syncSetup.