chrome extension with cloud storage

你说的曾经没有我的故事 提交于 2019-12-03 07:32:27

Why can't you use Google App Engine? The API is pretty easy to use. Or use other Google services tied to each individual user such as Google Docs. That is how Google Chrome Sync stores bookmarks that are synchronized in your browser through Docs.

Concerning localStorage, localStorage is a key value storage API for JavaScript (Client Side). If you want to store your extension's localStorage externally online, you can iterate your storage keys/values and store them through contacting some external (whatever API you use) service. And retrieve them every time your extension starts (in background.html page).

Why would you do that though? Google Chrome Sync, synchronizes all those information by default.

Jason Hall

FYI there is a new extension API to asynchronously store things like user settings, and optionally sync them across the user's other devices.

https://developer.chrome.com/extensions/storage.html

For example:

chrome.storage.sync.set({name:'Bob'}, function() {
  console.log('Name saved');
});

// Later on...
chrome.storage.sync.get('name', function(r) {
  console.log('Name retrieved: ' + r['name']);
});

Using sync will sync this across devices, using local will not.

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