So, I am trying to insert a button into a site that I do not own using Google Extensions.
I was able to make it work on the body, but not using getelementid
But the button does not show up where it was suppose to.
It is because it is inside an iframe? What can I do to insert a button?
Thanks!
This image shows the error https://i.stack.imgur.com/TvUfG.png
manifest.json
{
"manifest_version": 3,
"name": "Button Injection",
"version": "1.0",
"description": "This extension injects a button into a web page.",
"permissions": ["tabs"],
"content_scripts": [
{
"matches": ["https://*/*"],
"js": ["script.js"],
"run_at": "document_end"
}
]
}
script.js
let button = document.createElement("button");
let button2 = document.createElement("button");
button.innerHTML = "Click Me";
button2.innerHTML = "Click Me2";
document.body.appendChild(button);
document.getElementById("gwt-debug-MainMessageView").appendChild(button2);