I’m making a simple browser game with keyboard navigation.
The problem is that I have iframes on the site and when the user clicks on one of the iframes the body event that detects keydowns simply doesn’t work unless the user clicks outside the iframe again.
Is there a way to detect keydowns regardless if the user clicks on an external iframe?
thanks
No. You cannot detect keypress on an external
iframe.In general, no scripts events can be run in an external
iframeand that’s by design.Just think of all the possibilities a malicious user would one have with such a, I would say, security hole.