Capturing keyboard shortcuts in an iframe: focusing?
I'm creating an IFrame to house an app that wants to listen to keypress events -- is there any way to give this iframe focus, so keypresses get passed to its own handlers, and not to the main p开发者_StackOverflow社区age's? (Clicking within the iframe works, but makes for an awful user-interface...)
Thanks!
-B
calling focus on the iframe itself does the trick. E.g. in jquery:
$("#MyIFrame").focus()
精彩评论