检测浏览器是否处于全屏模式 [英] Detecting if a browser is in full screen mode

查看:45
本文介绍了检测浏览器是否处于全屏模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法可靠地检测浏览器是否在全屏模式下运行?我很确定没有任何我可以查询的浏览器 API,但是有没有人通过检查和比较 DOM 公开的某些高度/宽度测量值来解决这个问题?即使它仅适用于某些浏览器,我也有兴趣了解它.

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 by inspecting and comparing certain height/width measurements exposed by the DOM? Even if it only works for certain browsers I'm interested in hearing about it.

推荐答案

Chrome 15、Firefox 10 和 Safari 5.1 现在提供 API 以编程方式触发全屏模式.以这种方式触发的全屏模式提供了检测全屏更改的事件和用于设置全屏元素样式的 CSS 伪类.

Chrome 15, Firefox 10, and Safari 5.1 now provide APIs to programmatically trigger fullscreen mode. Fullscreen mode triggered this way provides events to detect fullscreen changes and CSS pseudo-classes for styling fullscreen elements.

参见 这个 hacks.mozilla.详情请参阅组织博客文章.

这篇关于检测浏览器是否处于全屏模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆