Chrome Extension: Unable To Pass Message To Content.js
I am trying to send a message from background.js to content.js. addListener in content.js is not working. background.js chrome.tabs.onUpdated.addListener(function(tabId, changeInf
Solution 1:
Your "matches": ["https://*/","http://*/"],
only specifies the domain wildcard which means that content scripts are injected for the main page only. The error message you see occurs because sendMessage
timeouts after some time as there was no content script to receive the message.
As the match pattern documentation says:
http://*/*
Matches any URL that uses the http scheme
The correct code would be "matches": ["https://*/*","http://*/*"],
P.S. Make use of the debugger, it's immensely helpful to catch such errors.
Post a Comment for "Chrome Extension: Unable To Pass Message To Content.js"