Probably I'm having a misunderstanding about how to use the browser_action, but basically I need to trigger an action on the actual tab opened on the browser via the popup.html opened when I click my extension icon and inside of this html I have a button for this trigger.
This is my code below, what I'm doing wrong?
manifest.json
{
"name": "Test",
"description": "Test",
"version": "1.0.0",
"manifest_version": 2,
"minimum_chrome_version": "46",
"permissions": ["tabs", "<all_urls>"],
"background":{
"scripts":["script.js"]
},
"browser_action": {
"default_title": "Test",
"default_popup": "popup.html",
"default_icon": {
"16": "/images/icon-16.png",
"48": "/images/icon-48.png",
"128": "/images/icon-128.png"
}
},
}
script.js
document.getElementById("myButton").addEventListener("click", test);
function test() {
alert("Message")
}
popup.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial- scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Ruiz Careca</h1>
<button id="myButton"> Show password</button>
<script type="text/javascript" src="./script.js" ></script>
</body>
</html>