I need to make a quick extension that runs a line of javascript whenever it is on a certain url, but I am have trouble figuring out how to do this. It isn’t working, but I am not sure what is wrong and don’t know how to troubleshoot this. Either a permission I am unaware of isn’t set, the javascript is never executed or the javascript is just wrong! Thanks in advance for the help with this sort of naive question.
manifest:
{
"name": "name goes here",
"version": "1.0",
"description": "checks a box",
"content_scripts": [
{
"matches": [ "https://urlofpage.com" ],
"js": ["script.js"]
}
]
}
here is the script
<script type = "javascript">
//<!--
var checkbox = document.getElementById("checkboxid");
checkbox.checked =true;
//-->
</script>
You should not have the HTML script tags in a .js file.