I've got a simple function that just passes location.href
from contentscript to the popup.html page. It's not working. what I've got is..
in popup.html..
chrome.tabs.getSelected(null,function(tab)
{
chrome.tabs.sendRequest({req: "getlocation"}, function(response){
return response.reply;
});
});
in my contentscript...
case "getlocation":
sendResponse({
reply: location.href
});
break;
Why isn't my code working?
Some params are missing, plus you can't use
return
from an async callback function.popup.html:
content_script.js: