If you know what you’re doing and don’t need my rambling, you can get what you want from here.
If not: I (and countless others) have spoken at length about AutoHotkey and why you should be using it. For the uninitiated, it is an extremely powerful and easy-to-learn scripting language that you can use to fix just about any problem you throw at it. You can use it to automate all your repetitive, boring tasks and even create entirely new workflows. Case in point: this article.
Either by bug or design, there has been a shortcoming in Firefox and Chrome for years now that allows Flash to steal focus from their containers and prevent any browser-specific hotkeys from accomplishing their tasks. That is, trying to hit Ctrl+W to close a YouTube tab after having clicked anywhere in the YouTube window will serve no purpose. Maybe you’re watching something you probably shouldn’t, when you probably shouldn’t, and your boss catches you because your hotkeys weren’t working. Oh the humanity.
The attached scripts are simple workarounds, but effective. AutoHotkey’s keyboard hook supersedes even that of Flash, so it can interpret hotkeys even when Flash has focus. These little programs simply receive the hotkeys, shift focus away from Flash, and send the hotkeys where you wanted them to go in the first place.
You can install AutoHotkey from here. Then it’s simply a matter of saving either the Firefox or Chrome version (or both, I guess) from the GitHub link at the start of this post and double-clicking it. Let me know if you need any more help, if this worked for you, or especially if it didn’t. Happy __tubing.