如何将文档属性(例如 document.webkitFullscreenElement)设置为 null

How do I set a document property (such as document.webkitFullscreenElement) to null?

本文关键字:webkitFullscreenElement 设置 null document 例如 文档 属性      更新时间:2023-09-26

当在Android WebView中点击html5视频标签的全屏按钮时,document.webkitFullscreenElement设置为我点击的视频(根据打印出来(。有没有办法手动将其设置为 null?

在我点击视频全屏之前

console.log(document.webkitFullscreenElement); //null

在我点击视频全屏后

console.log(document.webkitFullscreenElement); //[object HTMLVideoElement]

设置为空

document.webkitFullscreenElement = null;

设置为 NULL 后

console.log(document.webkitFullscreenElement); //[object HTMLVideoElement]

这不是可编辑的属性,但您可以创建自己的特征检测变量:

var hasFullscreenEl = !!document.webkitFullscreenElement;

然后,您可以将其设置为稍后null。不完全确定这里的用例是什么,所以如果这没有帮助,请告诉我。

我最终弄清楚了。我只需要手动调用它。

document.webkitExitFullscreen();
相关文章:
  • 没有找到相关文章