How to synchronize Chrome extension data on different computers?

给你一囗甜甜゛ 提交于 2019-11-30 03:03:42
Mohamed Mansour

Edit: As of Chrome 20 and above you can use chrome.storage module to save to the cloud.

chrome.experimental.storage.sync.set({'settingAlwaysOn': true}, function() {
  console.log('Saved option in the cloud');
});

Before Chrome 20

You're right, the Chrome Sync for extensions options (in settings) does not synchronize extension data. The only way to synchronize those data is through a third party.

Since you ruled out the usage of Bookmarks, which makes sense if users don't want bookmarks to be synchronized.

Everytime you persist data through storage (Web SQL Storage, localStorage, IndexDB), you grab that object, and serialize it into JSON (via JSON.stringify), and you send it to some online service such as Google Docs.

That would be quite tricky for Web SQL Storage and IndexDB, you would have to do your own importer and exporter. For localStorage it is pretty simple, since its a key/value pair.

It requires some work to link it to a Google Account (such as Docs) you would have to use OAuth and do the plumbing to connect your extension to the service. Once your connected, it is not that difficult to maintain the state.

Good luck :)

Chrome 20 supports chrome.storage.sync API. It seems to fit your requirements perfectly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!