如何同步 Chrome 扩展选项
我制作了一个带有选项页面的 Chrome 扩展。数据保存在本地存储中并且工作正常。
Chrome 不会将本地存储同步到云端,只是将扩展同步。这意味着任何用户数据都不会同步到同一谷歌帐户的其他计算机。
我在 http://developer.chrome.com/extensions/docs.html< 找不到 API /a> 它允许我同步用户选择的首选项。
您建议采用什么方法?
I've made a Chrome extension with an options page. The data is saved in localstorage and works just fine.
Chrome doesn't sync the localstorage to the cloud, just the extensions. This means that any user data will not sync to other computers of the same google account.
I can not find an API at http://developer.chrome.com/extensions/docs.html which allows me to sync the user-chosen preferences.
What methods do you suggest?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在不久的将来,您将您现在可以在chrome.storage.sync
,它将自动同步。除非您现在需要某些东西,否则请考虑将所有配置放在一个对象中,稍后您就可以同步它!
编辑:现在在稳定版 Chrome 中可用< /a>!
In the (hopefully near) future, you'll beYou are now able to store stuff inchrome.storage.sync
, and it will be synced automagically.Unless you need something right now, do consider putting all your configurations in an single object, sometime later you'll be able to just sync it!
Edit: now this is available in stable Chrome!
Nathan Moos 告诉了你真相 :) 但你不需要自己写它,你可以使用 Sylebot 扩展。您将需要文件 js/sync.js。源代码很棒,而且效果很好!
Nathan Moos told you truth :) But you don't need to write it by oneself, you can use Ankit Ahuja solution from Sylebot extension. You will need file js/sync.js. Source code is great, and it works great!
您应该能够使用HTML5 WebDatabases,但不能。请参阅下面的评论。
You should be able to use HTML5 WebDatabases, but you cannot. See comments below.
您可以将某些选项序列化为书签,并告诉用户启用书签同步。然后,您可以从书签中读取或在书签周围构建伪“localStorage”对象。
You could serialize some of the options to a bookmark and tell the user to enable bookmark sync. Then, you could read from the bookmark or build a pseudo-"localStorage" object around the bookmark.
您可以尝试使用 Google Docs 来完成此操作,就像 Chrome 使用书签一样。我不知道 api 能达到多远,但这似乎是一个相当基本的操作。
You could try to do it with Google Docs like Chrome does with bookmarks. I don't know how far the api reaches but this seems a rather basic operation.