fullscreenchange event not firing in Chrome

前端 未结 1 530
隐瞒了意图╮
隐瞒了意图╮ 2020-12-10 02:48

I\'m trying to monitor when the browser enters fullscreen mode.

This blog is referenced everywhere I search as the guide on the fullscreen API.

http://rober

相关标签:
1条回答
  • 2020-12-10 03:44

    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.

    0 讨论(0)
提交回复
热议问题