So I started making a chrome extension, but bumped into a problem rather fast, when I press a button (only element in the popup.html file), it does not run a script that it should, while it does when I run the html file as a webpage.
<!DOCTYPE html>
<html>
<head>
<script>
function mainbuttonpressed() {
document.getElementById("mainbutton").innerHTML = "B"
console.log("pressed1")
alert("You pressed the button!")
console.log("pressed2")
}
</script>
<link rel="stylesheet" href="button.css">
</head>
<body>
<button id="mainbutton" type="button" onclick="mainbuttonpressed()">A</button>
</body>
</html>
How does it come that it works when I use it as webpage, but the exact same html doesn't react when used as the default_popup in a chrome extension?