I would do this using message parsing . Essentially, you add a listener function to your background page, similar to this: (slightly simplified example on the documentation page)
chrome.extension.onRequest.addListener( function(request, sender, sendResponse) { console.log("Received a request!"); if (request.message == "hello") sendResponse({message: "goodbye"}); });
The background page retrieves the information and returns it to the popup using the sendResponse function.
Then, in your popup menu, you implement something like this:
chrome.extension.sendRequest({message: "hello"}, function(response) { console.log(response.message); });
Messages (parts of {message: "hello"} ) can be any JSON compatible object.
source share