I’m developing an extension for Google Chrome browser.
I could not figure out how to access the current tab DOM object from the “popup.html” page.
any suggestions?
I’m developing an extension for Google Chrome browser. I could not figure out how
Share
By default, within popup.js/popup.html, the “document” object refers to the extension’s popup window’s document only. To get the DOM for a specific tab (for instance the currently active tab), you would need to use content scripts communications. For example we need to send a request from the extension to your content script via popup, so in the popup.html you do something like this:
Now in the content script, we need to listen for those events coming from the extension, so in some file we named dom.js
Now remember to setup your manifest to include the content script and tab permission.