嗨,我有一个网页,我想从现有页面打开div元素(有一个id)和它的内容到全屏。它在FF和Chrome中工作很好,但在IE10或IE11中不起作用。我在控制台日志中没有错误。

我使用类似的方法到我发现的这个在线示例,我发现IE: http ://davidwalsh.name/demo/fullscreen.php 。 IE中是否有一个设置,需要启用以显示全屏? F11对我有效。我认为可能存在安全设置?

我正在使用ms自己的文档中定义的代码: http://msdn.microsoft.com/ en-US / Library / IE / DN254939(v= Vs.85).aspx

function requestFullScreen(element) {
           // Supports most browsers and their versions.
       var requestMethod = element.requestFullScreen || 
                            element.webkitRequestFullScreen || 
                            element.mozRequestFullScreen || 
                            element.msRequestFullScreen;

        console.log("element.msRequestFullScreen" + element.msRequestFullScreen);

        if (requestMethod) { // Native full screen.

            requestMethod.call(element);
        } else if (typeof window.ActiveXObject !== "undefined") { // Older IE.
            var wscript = new ActiveXObject("WScript.Shell");
            if (wscript !== null) {
                wscript.SendKeys("{F11}");
            }
        }
    }

  $(".fullscreen").live('click',function(event) {


     var elem = document.getElementById("fulltextview"); // Make the fulltext    
   view elements contents go full screen.
  requestFullScreen(elem);
});
.

在此示例中,变量RequestMethod始终是未定义的。
是因为IE没有检测到onClick事件,从而阻止由于安全问题的要求?需要更多帮助。 (是的,我被迫使用旧版本的jQuery 1.4.4)

有帮助吗?

解决方案

IE10不支持全屏

IE11支持标准版本,例如,msRequestFullscreen()。请注意,s是小写的。

这里有很多好的信息: http://generatedcontent.org/post/70347573294/is-your-uflscreen-api-code-up-to-date-find-out-how-to

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top