Background.js Doesn't Find Content Injected With Content Script
My Chrome extension has a Content-Script that injects a custom DIV into the current page. This part works. But then, the extension also has a right-click Context Menu, which when c
Solution 1:
Wrong document
in
var divHTML = document.getElementById('infoDiv').innerHTML;
Please read the Architecture Overview first. Your background script is executed in a separate HTML document, and as such won't "see" the page in the tab.
You'll need to pass the value to the content script to do something with a visible page. You'll probably need Messaging.
Post a Comment for "Background.js Doesn't Find Content Injected With Content Script"