chrome.storage.sync 无法跨浏览器和设备同步

ors*_*iro 3 google-chrome google-chrome-extension

我在扩展中使用chrome.storage.sync来同步在popup.html.

它在本地正确存储和恢复数据,但不会跨浏览器同步数据。

每个浏览器扩展都有自己的本地输入数据可用。

下面的代码用于保存和恢复数据:

// 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);
});
Run Code Online (Sandbox Code Playgroud)

在我的文件中,manifest.json我授予以下权限storage:

    "permissions": [
        "tabs", 
        "http://*/*", 
        "storage"
    ]
}
Run Code Online (Sandbox Code Playgroud)

Chrome Sync 无法跨浏览器和设备同步的原因是什么?

Chr*_*and 5

您的扩展程序是否已上传到您的 Chrome Web Store 帐户并发布(或至少发布给您的测试人员)?

上次我检查时,跨计算机同步不适用于非 Web Store 扩展,因此您必须将其放在 Chrome Web Store 上进行测试。

您还必须确保在 下选中“扩展”chrome://settings/syncSetup。

  • 转到 chrome://sync,您将能够查看同步是否正常工作以及正在同步哪些确切数据。 (6认同)