Set focus on web page rather than Firefox debugger after refreshing page

萝らか妹 提交于 2019-12-14 00:35:52

问题


I'm using the default Firefox web developer tools. Firefox 20.0, Mac OS X 10.7.

If I have the developer tools' Debugger panel open (but not focussed), and refresh the page, focus goes to the debugger panel rather than the refreshed page. Can I set focus to go to the refreshed page instead?

If I have the Web Console panel open instead, that doesn't steal the focus - ideally I'd like to get the debugger to behave the same way.

My program uses document keyup and keydown events, and the page needs focus for these to work. Having to click on the page each time is proving surprisingly annoying (it's only a small thing, but it's doubling the amount of work required for each refresh!).


回答1:


This is still an annoyance, as of Firefox 61.0.2 (Windows 7).

The only workaround I've found is to have Developer Tools set to run in "Separate window" mode - instead of docked to the browser, like:




回答2:


use this on page

 <body onload = "window.focus();">


来源:https://stackoverflow.com/questions/16493107/set-focus-on-web-page-rather-than-firefox-debugger-after-refreshing-page

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