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!).
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:
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