Detecting if a browser is in full screen mode

后端 未结 17 1857
误落风尘
误落风尘 2020-11-27 06:10

Is there any way of reliably detecting if a browser is running in full screen mode? I\'m pretty sure there isn\'t any browser API I can query, but has anyone worked it out b

17条回答
  •  [愿得一人]
    2020-11-27 06:41

    Just thought I'd add my thruppence to save anyone banging their heads. The first answer is excellent if you have complete control over the process, that is you initiate the fullscreen process in code. Useless should anyone do it thissen by hitting F11.

    The glimmer of hope on the horizon come in the form of this W3C recommendation http://www.w3.org/TR/view-mode/ which will enable detection of windowed, floating (without chrome), maximized, minimized and fullscreen via media queries (which of course means window.matchMedia and associated).

    I've seen signs that it's in the implementation process with -webkit and -moz prefixes but it doesn't appear to be in production yet.

    So no, no solutions but hopefully I'll save someone doing a lot of running around before hitting the same wall.

    PS *:-moz-full-screen does doo-dah as well, but nice to know about.

提交回复
热议问题