我有一个带有媒体库的 html 文档:
<div class="videoTabClass" id="videoTab">
<div id="videoGalleryTEST">
<video controls="controls" preload="metadata" class="media-content" style="height: 150px;" title="" src="test.mp4"></video>
<button onclick="makeFullScreen">
Fullscreen
</button>
</div>
</div>
按钮有一个功能:
function makeFullScreen(evt) {
var testFullScreen = document.getElementById("videoGallery");
var divObj = document.getElementById("videoGallery");
if (divObj.requestFullscreen)
if (document.fullScreenElement) {
document.exitFullscreen();
} else {
divObj.requestFullscreen();
}
else if (divObj.msRequestFullscreen)**//true in simple *.html but undefined in asp.net**
if (document.msFullscreenElement) {
document.msExitFullscreen();
} else {
divObj.msRequestFullscreen();
}
else if (divObj.webkitRequestFullscreen)
if (document.webkitFullscreenElement) {
document.webkitCancelFullScreen();
} else {
divObj.webkitRequestFullscreen();
}
}
当我在简单的 html 文件中调试此代码时,一切正常。我的视频库在所有浏览器中全屏显示。当我在 ASP.NET 站点中调试此功能时,问题出现了。在 Chrome 和 Mozilla 浏览器中它仍然可以,但在 IE-11 中没有指定 div 元素的 msRequestFullscreen() 函数,它只是未定义。asp.net 如何影响 html 元素?