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 -:
1 Odpowiedź
+ 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