catch-all keyup/keydown events in iframe?

流过昼夜 提交于 2019-12-01 03:45:57

You can't, not unless the frame has focus.

What you can do is make a keydown on the outer window focus the iframe, or always somehow focus the iframe, or focus the iframe by default (might be good enough, not sure what you're doing)

But for the window keydown to fire on any window (frame or not) that frame needs focus.

It seems you can just do var realWindow = window.parent || window; and use addEventListener on realWindow instead.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!