0

So I'm making a Chrome Extension and am currently making it so that if you press the "A" key, then an alert pops up. I've gotten this to work when I open my HTML file through my extension folder. However, when I unpack my folder into a Chrome extension and test it as a Chrome extension, the script won't run.

<script>
    window.addEventListener("keyup", checkKeyPress, false);

    function checkKeyPress(key){
      if (key.keyCode =="65"){
        alert("test")
      }
    }
    </script>
Aurora123
  • 125
  • 10
  • Use a separate js file as [explained here](https://stackoverflow.com/a/25721457). P.S. use the [**correct** devtools for the popup](https://stackoverflow.com/a/38920982). – wOxxOm Jul 06 '19 at 04:13

1 Answers1

0

Here is the code --->

<script>
window.onload = function(){
   window.addEventListener("keydown", function(e){
      if(e.keyCode == 65){
         alert()}})
}
</script>