Reputation: 3
I can't save the data that is form data from index.html in the chrome local storage. I also tried to save the data in chrome sync storage but both are not working and already checked my local storage in chrome://extensions but, there were no data.... What should I do for save the data in chrome extension storage?
manifest.json
{
"manifest_version": 2,
"name": "index",
"version": "1.0.0",
"description": "index descript",
"icons": {
"512": "img/logo.png"
},
"browser_action": {
"default_icon": {
"16": "img/logo.png"
},
"default_popup": "index.html",
"default_title": "index",
"use_navigation_bar": false,
"mobile_user_agent": true
},
"background": {
"scripts": [ "js/background.js" ]
},
"permissions": ["tabs", "notifications", "storage"]
}
(function(){
var form = document.querySelector('form');
form.addEventListener('submit', function(evt){
evt.preventDefault();
runStorage();
})
})()
function runStorage() {
var country = $("#selectCur").val(),
krw = $("#wantKRW").val(),
date = $("#pdate").val(),
arr = [country, krw, date];
chrome.storage.local.get(['data'], function(res) {
if(res.data) {
res.data.push(arr);
var a = res.data;
chrome.storage.local.set({ data : a}, function() {
});
}
});
}
Upvotes: 0
Views: 170