KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the background.html : chrome.tabs.query({active:true, currentWindow:true},function(tabs){ chrome.tabs.sendMessage(tabs[0].id,"target.js"); }); In the content.js : chrome.extension.onMessage.addListener(function(msg,sender,sendResponse){ if (msg == "target.js"){ extensionID = sender.id; } }); However, it doesn't work; Uncaught TypeError: Cannot read property 'onMessage' of undefined How to make it right?
Tags (comma-separated)
Save Edits
Cancel