How are chrome extensions made | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How are chrome extensions made

I was just reading articles, and watching videos about how to make chrome extensions. But one thing I don’t understand is... Like... let’s say this extension changes the color of buttons on your website. Do we get the element (the button), doc.getElem...(“button”), then add css to it or JS, Orr ... How does it work I don’t understand -:

9th Dec 2019, 11:46 PM
Ginfio
Ginfio - avatar
1 Answer
+ 5
1. Simple behavior is implemented by incorporating appropriate keys in a JSON file named manifest.json https://developer.chrome.com/extensions 2. For complex behavior, use BrowserAction API. 2.1 You can execute JavaScript scripts in this way: "background": { "scripts": ["background.js"] } // background.js chrome.extension.onMessage.addListener(function(message, sender) { chrome.browserAction.setBadgeBackgroundColor({ color: 'red', tabId: sender.tab.id }); }); Reference : https://stackoverflow.com/questions/13564277/chrome-extension-change-address-bar-button-background-color-at-runtime
10th Dec 2019, 3:40 AM
Gordon
Gordon - avatar