Hello programmers.

Is it possible to monitor keystrokes if a browser has been minimized? Or will I need to learn C++ or something similar, and make a program, to do this?

My idea is that I want to have a site running in the background while I'm playing a game and still be able to monitor if the person presses the F1 button on his keyboard and then play a sound.