Skip to content Skip to sidebar Skip to footer

Chrome Extension Sendmessage From Popup.html To Content.js Not Working

I'm trying to build an Extension which sends data from the popup.html to the tab dome, but I can't get the sendMessage to work and I don't understand why. I'm following this guidli

Solution 1:

oops, I think you just send message to popup.js itself...

getSelected in popup.js listen the activity of popup tab(it is a tab in chrome too) thus, the tab id is actually the popup tab, not the tab where your content.js are inserted

BTW getSelected is deprecated. Try alternatives? http://developer.chrome.com/extensions/tabs.html#method-getCurrent

Solution 2:

Ok, I'm stupid... the wrong thing was... the inspector page I was watching. "console.log" inside of the content.js prints on the TAB INSPECTOR CONSOLE not on the extension one!

I hope it will help others.

Post a Comment for "Chrome Extension Sendmessage From Popup.html To Content.js Not Working"