Chrome Extension: Message Passing (Sending the DOM to popup.js) returns 'null'
I would like to use a Chrome Extension to download the current page's DOM. I'm not sure why, but when my download occurs, the result is just a text file with either 'null' or 'undefined', rather than the DOM. I've tried to assimilate the knowledge from here and here , but I can't seem to get the message from content.js through to popup.js . Additionally, I'm not sure why this actually works. When I read the docs , it seems like I need to send the message from popup.js to content.js by selecting the active tab: chrome.tabs.query({currentWindow: true, active: true}, function(tabs) { chrome.tabs