Answer the question
In order to leave comments, you need to log in
How to work with chrome.storage.sync.(get\set)?
Dear, I need help, I can't figure out how to work with chrome.storage.sync via content-script...
{
"name": "PTS",
"version": "1.0",
"manifest_version": 2,
"content_scripts":
[
{
"matches": ["https://google.ru/"],
"js": ["jquery.js", "include.js"]
}
],
"background": {
"scripts": ["window.js"]
},
"browser_action":
{
"default_popup": "window.html",
"default_title": "PTS"
},
"permissions":
[
"storage",
"notifications"
]
}
$().ready(function()
{
chrome.storage.sync.get('interval', function (result)
{
$('body > form > input[type="text"]').val(result.interval)
});
$("body > form > button").click(function()
{
chrome.storage.sync.set({"interval" : $('body > form > input[type="text"]').val()})
chrome.notifications.create({type: 'basic', iconUrl: 'icon.jpg', title: "", message: "\nИнтервал успешно сохранен." }, function(){window.close();})
})
})
$().ready(function()
{
alert("Loaded...");
var INTERVAL = 600000;
setInterval(function()
{
location.reload();
}, INTERVAL)
})
Answer the question
In order to leave comments, you need to log in
Only via messages
https://developer.chrome.com/extensions/messaging
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question