3

我正在使用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);
});

在我的manifest.json我授予权限storage

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

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

4

2 回答 2

4

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

我上次检查的非网上应用店扩展程序无法跨计算机同步,因此您必须将其放在 Chrome 网上应用店进行测试。

您还必须确保在chrome://settings/syncSetup.

于 2013-08-01T07:28:58.413 回答
0

Google Storage API 似乎有一些限制,每分钟的同步次数和要同步的项目的权重。我发现了这个: http: //www.developer.com/lang/synchronized-storage-between-multiple-computers-with-chrome-sync.html

我希望它会有所帮助;)

于 2013-10-26T15:45:20.213 回答