首页 > 解决方案 > 在 IE 10 中请求全屏

问题描述

我尝试使用下面的功能

function goFullscreen(id) {
  var element = document.getElementById(id);
  if (element.msRequestFullScreen) {
    element.msRequestFullScreen();
  } else if (document.msExitFullscreen) {
    document.msExitFullscreen();
  }
}

我希望在 IE 10 中支持 Javascript,因为浏览器在 IE 10 中运行,但请求全屏仅支持 IE 11。有什么方法可以在 IE 10 中支持?

标签: javascript

解决方案


对您有用的方法之一是使用:

var myWindow = window.open("", "_self");
myWindow.document.write("<p>I´m ready</p>");

您只需传递带有 html 和必要功能的对象。我希望它对你有用

在我的代码中,我直接打开特定窗口并为我需要的功能做好准备

function openFullWindow(CTri) {

   if (window.name != 'salidas') {
       url_src = "test.asp?Indice=<%=indice%>&Numero=<%=numero%>&IdUser=<%=iduser%>&CodTribunal="+CTri;
       w=800;
       h=600;
       if (window.screen) {
           w = window.screen.availWidth;
           h = window.screen.availHeight;
       }
       manejadorVentana = window.open(url_src, "salidas", "toolbar=no,location=no,directories=no,scrollbars=yes,menubar=no,width="+w+",height="+h+",top=0,left=0");
    }
}

从大窗口启动到小窗口的事件是window.opener


推荐阅读