You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to use the built-in content script to update the dom on the active tab I am currently viewing. The issue I am running into is that the content scripts are updating the extension itself instead of the active Tab's DOM. Is there a specific way to use the content scripts so that I can inject JS into the active tab? Or are there any resources I can take a look at.
The text was updated successfully, but these errors were encountered:
Here is an example that I have created.
In my contentScript folder, I have an index.js file that manipulates the dom, and then renders a react component in the DOM.
exportfunctionattachButtonSwitchers(){//Code to manipulate the DOM, such as:constbuttonContainer=document.createElement("div")buttonContainer.style.display='inline'buttonContainer.appendChild(...);chatHeader.parentNode.replaceChild(buttonContainer,chatHeader)}// Code to render an element in some div that I created and tagged```jsexportfunctionmountReactPogger(){ReactDOM.render(<React.StrictMode><Pogchat/></React.StrictMode>,document.getElementById("pogchat-container"));}
My react component is then in this file, inside of the contentScript folder.
The final result is that I get, in my case, a modified twitch chat:
I am attempting to use the built-in content script to update the dom on the active tab I am currently viewing. The issue I am running into is that the content scripts are updating the extension itself instead of the active Tab's DOM. Is there a specific way to use the content scripts so that I can inject JS into the active tab? Or are there any resources I can take a look at.
The text was updated successfully, but these errors were encountered: