I’m working on a canvas-based game and am using window.addEventListener() to attach keyup and keydown events globally. This works in when viewing the page normally, but when embedding it as an iframe; it doesn’t get the keyup and keydown events. Is there a better way I can do this?
I’m working on a canvas-based game and am using window.addEventListener() to attach keyup and
Share
It seems you can just do
var realWindow = window.parent || window;and use addEventListener onrealWindowinstead.