Я работаю над расширением Chrome, которое хранит данные в локальном хранилище.Но когда я устанавливаю на чью-либо систему из магазина Chrome Play, он просит включить синхронизацию.Ниже мой манифест.Интересно, что даже если кто-то отказывается включить синхронизацию, она все равно работает.
{
"manifest_version": 2,
"name": "XX",
"description": ".....",
"version": "0.1",
"chrome_url_overrides": {
"newtab": "newtab.html"
},
"icons": {
"16": "icon_16.png",
"128": "icon_128.png",
"48": "icon_48.png"
},
"content_scripts": [
{
"matches": [
"http://*/*"
],
"css": [
"bootstrap.css"
],
"js": [
"jquery.js",
"bootstrap.js",
"custom.js"
],
"run_at": "document_end"
}
],
"background": {
},
"browser_action": {
"default_title": "..."
},
"permissions": [
"tabs",
"storage"
]
}
Что я делаю не так?
Обновление Ниже приведен кодсвязанные с хранением
// Fetch last timestamp
chrome.storage.local.get('records_fetch_ts', function (date_rec) {
old_time = date_rec['records_fetch_ts'];
if(typeof old_time != 'undefined') {
current_time = new Date().getTime()
var timeinmilisec = current_time - old_time;
days = Math.floor(timeinmilisec / (1000 * 60 * 60 * 24));
}
});
chrome.storage.local.get('records', function (result) {
records = result;
//records = null;
if (!$.isEmptyObject(records))
entries = JSON.parse(result['records'])
// Preparation of Random result
if (entries.length > 0)
itemsLength = entries.length;
if (itemsLength > 0)
random_number = Math.floor((Math.random() * itemsLength) + 1);
single_item = entries[random_number];
console.log(single_item);
if (single_item != null)
$('#asin').html(single_item['asin'])
updateUI(single_item)
console.log(days)
//if (records == null && days > 10) {
if ((days < 0 || days > 10) || records == null) {
console.log('Fetch me dude');
fetchData();
}
});