Possible Duplicate:
Port error while changing chrome extension from manifest v1 to v2
I am creating a chrome extension where I store data in localStorage of the background page. I am taking the data from a content script and sending it to background page via message passing, I don't know why, but the data is not getting stored.
Here is the code snippet I have written.
background.html:
<script>
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
localStorage.setItem(request.username,request.password);
sendResponse(null);
});
</script>
content-script:
document.getElementById('login_form').addEventListener('submit',
function(){
_Userid = document.getElementById('email').value;
_UserPass = document.getElementById('pass').value;
chrome.extension.sendRequest({username: _Userid, password: _UserPass}, function(response) {
alert('done') });
},false);
Please Note that Message passing is working fine, as I do get the response back from , background page and an alert box also appears.