CasperT
CasperT

Reputation: 3475

How to sync chrome extension options

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?

Upvotes: 32

Views: 8920

Answers (5)

Camilo Martin
Camilo Martin

Reputation: 37918

In the (hopefully near) future, you'll be You are now able to store stuff in chrome.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!

Upvotes: 34

fncomp
fncomp

Reputation: 6198

You should be able to use HTML5 WebDatabases, but you cannot. See comments below.

Upvotes: 3

user520023
user520023

Reputation:

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!

Upvotes: 5

Jan
Jan

Reputation: 8151

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.

Upvotes: 1

Nathan Moos
Nathan Moos

Reputation: 3643

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.

Upvotes: 2

Related Questions