fullscreenchange
events do work, but only if the fullscreen mode is triggered by requestFullscreen
.
There appears to be a security restriction that prevents JavaScript from monitoring if a user manually enables fullscreen mode via a hotkey.
Alternatively, you can monitor the resize events to see if the window matches the desktop size, but this seems like a hack to me (i.e. would this work on dual-monitors?)
I decided to abandon monitoring of fullscreen mode, and just use the API to toggle the state.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…