add button to page with chrome extension

google-chrome, google-chrome-extension

Solution

You can use that code in a `content script` set to run on specific webpages.

Content scripts are JavaScript files that run in the context of web pages. By using the standard Document Object Model (DOM), they can read details of the web pages the browser visits, or make changes to them.

Problem

is it possible to add simple button with onclick event to a page with chrome extension? for instance if I am looking at google.com ``` var google = document.getElementById("main"); var button = document.createElement("button"); var text = document.createTextNode("test"); button.appendChild(text); google.appendChild(button); ``` I see my button in it?

Original source