I have a canvas element in a simple html document with an attached keydown
and keyup
listener. This works correctly when I load the document in the browser and start pressing the keys. However, if I load the document in an iframe, nothing happens when I press the keys. It seems the key events never enter the iframe or the document inside the iframe. Is there a way to fix this?
Asked
Active
Viewed 1.0k times
4

Brian Tompsett - 汤莱恩
- 5,753
- 72
- 57
- 129

Marius
- 57,995
- 32
- 132
- 151
-
What element were you focused on when pressing keys? iFrames can only listen to events in themselves. – Digital Plane Sep 21 '11 at 22:19
-
Code? Example? http://jsfiddle.net/? – Jared Farrish Sep 21 '11 at 22:21