I'm currently working on developing a chrome extension that requires storing data locally. However, I am facing an issue with the code in my popup.html file as it is not setting values in local storage as expected. My manifest.json file has both "storage" and "tabs" permissions granted.
<script type="text/javascript">
function save() {
var username = document.getElementById('username').value;
var password = document.getElementById('password').value;
chrome.storage.local.set({'username': username}, function(){});
chrome.storage.local.set({'password': password}, function(){});
}
</script>
Roll Number
<input type="text" name="username" id="username"></input>
Password
<input type="password" name="password" id="password"></input>
<button onclick="save()" type="submit" name="submit">Save</button>
This snippet showcases my manifest.json configuration:
{
"manifest_version": 2,
"name": "Autologin",
"description": "Blah blah.",
"version": "1.0",
"permissions": [
"http://xxxxxxxxxxxxx/*",
"storage"
],
"content_scripts": [
{
"matches": ["http://xxxxxxxxxxxxx/*"],
"js": ["autologin.js"]
}
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "autologin.html"
}
}