I'm working on a google extension where I want to change the background-color of youtube.com by pressing a button in my popup.html and then running my function.
Here is my code:
The JavaScript file ms.js:
function color1(){
document.getElementById("body-container").style.backgroundColor="blue";}
The HTML popup.html file:
<!DOCTYPE html>
<html>
<head>
<script src="ms.js">
</script>
</head>
<body>
<p> TEST </p>
<input type="button" value="blue" id="btn1" onclick="color1"/>
</body>
</html>
Here is my manifest.json file:
{
"name": "my extension test",
"version": "1.0",
"permissions": [
"activeTab",
"pageCapture"
],
"manifest_version": 2,
"description": "Test extension :D",
"browser_action": {
"default_icon": "ikon.png",
"default_popup": "popup.html"
},
"web_accessible_resources": [
"script/ms.js"
],
"content_scripts": [
{
"matches": ["https://www.youtube.com/*"],
"js": ["ms.js"]
}
]
}