As in title I am creating a chrome extension. I would like to execute a script that will have access to a website DOM. I know I can add:
"background": {
"scripts": ["background.js"]
},
to manifest.json file but it does not have access to document object of the actual website. It only has access to extension.
When I add:
"content_scripts": [
{
"matches": ["https://www.website.com/*"],
"js": ["script.js"]
}
]
to manifest.json it will run automatically when page loads. I want it to run when I click on extension icon. How can I achieve it?
I know I can add a popup on the extension and then add a button etc. but I don't want it. I just want to click on the icon and run script that will have access to whole DOM.