Hey I have been trying to create a ' first extension' for quite a few hours following tutorials and blogs but the problem ive run across is trying to implement Javascript , Ive used a combination of JS and HTML to make webpages and Java for some basic programs but whenever I attempt to make a simple alert tag with the simple hello world text nothing happens , ive played around with it a bit and found out I cannot use inline jS so I looked at This post and attempted to imitate the code presented here and got this :
MANIFEST:
{
"manifest_version" : 2 ,
"name" : " Test" ,
"version" : "1.0",
"description" : " A basic test extension" ,
"icons" : {
"128" : "icon_128.png"
} ,
"background" : {
"scripts" : ["java.js"]
},
"browser_action": {
"default_icon" : "icon_128.png" ,
"default_title" : "Testing" ,
"default_popup" : "popup.html"
},
"permissions": [
"background",
"tabs",
"http://*/*",
"https://*/*"
]
}
POPUP.HTML
<html>
<head>
<!-- <script src='java.js'>
</script> -->
<!--
this went on manifest page
"content_scripts": [
{
"matches": ["https://*/*"],
"js": ["java.js"]
}
],
-->
</head>
<body>
<h2 ><b>WELCOME</b></h2>
<hr>
<input id="clock" class="clock" value="click" type="button">
<p id="p">
</p>
</body>
</html>
JAVA.JS
/*function hello(e){
alert("Hello World");
}
var ClickBtn = document.querySelector('.click');
ClickBtn.addEventListener('click' , hello);
*/
/*
function hello(e){
alert("Hey");
}
document.getElementsById("clock").addEventListener("click", hello)
*/
function hello(e){
var work = "It is working";
console.log(work);
}
chrome.browserAction.onClicked.addListener(hello)
and it's still not working , can anyone help me?