Domanda

I have a simple extensions that saves some data to chrome storage

var dt = new Date();
var item = {};
item[$('#qteSymb').text() + "-" + guid()] = $('#newnote').val() + "-:-" + $.datepicker.formatDate('mm/dd/yy', dt) + " " + dt.getHours() + ":" + (dt.getMinutes() < 10 ? "0" + dt.getMinutes() : dt.getMinutes());           
chrome.storage.sync.set(item, function(){
    renderNotes();
});   

This works fine locally - my extension is working as intended - but it doesn't sync back to another computer. I am assuming the sync is ON on both computers because the bookmarks, extensions, etc. sync just fine.

Thank you!

È stato utile?

Soluzione

So I finally figured this out. When not using Chrome Web Store your manifest file should include a key (https://developer.chrome.com/extensions/manifest.html#key)

...
"key":"myawesomeextension"
...

Without this every time you install the extension on a different device (through chrome://extensions/ --> Load unpacked extension) it gets a new id and therefore the data being synced doesn't get matched to the correct extension - same extension with different ids = two different extensions in the eyes of Chrome.

There is no need for a key once the extension is in Chrome Web Store. Hope this helps somebody keep some hair at some point.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top