How can I sync localStorage across Chrome instances (or use chrome.storage.sync without a published extension)? How can I sync localStorage across Chrome instances (or use chrome.storage.sync without a published extension)? google-chrome google-chrome

How can I sync localStorage across Chrome instances (or use chrome.storage.sync without a published extension)?


This doesn't really answer the question as I originally asked it, but this is what I ended up doing to solve the problem described above, so whatever.

  • In the end, I abandoned the idea of using chrome.storage (the space restrictions on chrome.storage.sync were untenable) and instead wrote my extension using PouchDB, which is a Javascript implementation of CouchDB. PouchDB uses IndexedDB internally, which does have a per-extension limit by default (I think 5 MB? I didn't bother to test), but can be granted unlimited storage by setting the "unlimitedStorage" permission in the extension manifest. PouchDB's storage model is significantly superior to the chrome.storage storage model in basically every way (free revision tracking, a documented sync protocol rather than whatever voodoo chrome.storage.sync does, etc.), and the downsides (an extra dependency, need for a separate remote server [see below], etc.) were not a huge issue for me.
  • I spun up a free EC2 micro instance and installed a CouchDB server on it. CouchDB is a little bit finicky to configure, but works well once that's taken care of. My EC2 instance stopped being free after a year, so I switched to Cloudant, which offers CouchDB-compatible hosting that's free if you use less than $50 worth of storage + bandwidth per month, which I do.
  • I set my extension to point at my Cloudant instance, have it authenticate using plain old HTTP basic authentication (which is fine here, since I'm the only person using this extension, which means I'm free to put my password in plaintext in the extension), and have it sync with the remote instance when requested by the user.
    • The authentication approach I took here (in conjunction with the deployment strategy [see below], etc.) probably has a bunch of holes, but I don't really care; it seems sufficient to stop casual intrusions, which is good enough (I'm not dealing with important or privileged data).
  • Rather than deploying my extension via the Chrome store, which seems complicated and costs money, I now have a rather more ghetto solution whereby I move my extension from my development machine to my other machines by copying the unpacked extension folder into my Dropbox folder and waiting for Dropbox to sync it to my other machines. I then load (or reload) the unpacked extension on my other machines. (This was easier than a Bitbucket-based solution [or any other Git-based solution] because my Windows machines all throw fits when I try to get anything done with Git.)
    • One downside of using Dropbox (or any other solution that involves unpublished unpacked extensions) rather than the Chrome store - Chrome pesters you about disabling non-store extensions every time you open Chrome, even if you're on the Chrome dev channel. In light of Xan's comments below, I'm probably going to take a second look at using the Chrome store as a means of deploying the extension.