是什么导致这个简单的焦点侦听器不起作用?
function appFocus() {
write("FOCUSED"); // write on the screen
}
appWin.addEventListener("focus", appFocus, false);
// appWin is my window
- 相同的代码适用于其他窗口,
- 其他侦听器也适用于此窗口
,那么,为什么 focus
事件仅适用于此窗口呢?请分享您的想法。
function appFocus() {
write("FOCUSED"); // write on the screen
}
appWin.addEventListener("focus", appFocus, false);
// appWin is my window
- This same code works well with other windows
- other listeners works well with this window
so, why specifically the focus
event does not work with just this window? Please, share your thoughts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到它:
我有一个带有“onload”的窗口,它将浏览器聚焦在窗口内。通过删除此加载,我可以让“onfocus”事件正常工作。
Found it:
I have a window with an "onload" that focus the browser within the window. By removing this onload I get the "onfocus" event to work.