Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add button to page with chrome extension

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?

like image 942
Ali Esmailian Avatar asked Aug 11 '13 16:08

Ali Esmailian


People also ask

How do I add an Add button to Chrome?

Open the Chrome Web Store. In the left column, click Apps or Extensions. Browse or search for what you'd like to add. When you find an app or extension you'd like to add, click Add to Chrome.

Can you use node js with chrome extension?

Chrome extension doesn't allow its native socket connection due to security issues. But we can achieve this via JavaScript socket connection. On the server side, we have used Node JS. The following is the architecture of Node JS, Chrome extension, and Socket.io integration.

How do I customize my google chrome button?

You can change Google Chrome's new tab background by clicking the "Customize" button in the bottom-right corner of a new tab.


1 Answers

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.

like image 112
Anirudh Ramanathan Avatar answered Oct 21 '22 11:10

Anirudh Ramanathan