Fullscreen not working in IE

2020-04-14 07:07发布

So I have my slider module up and running but Internet Explorer 11 is not responding to the fullscreen button. Firefox and Chrome are working just fine. I found this code on Stack but still no difference. Any thoughts?

function toggleFullScreen() {
  if (!document.fullscreenElement &&    // alternative standard method
      !document.mozFullScreenElement && !document.webkitFullscreenElement) {  // current working methods
    if (document.documentElement.requestFullscreen) {
      document.documentElement.requestFullscreen();
    } else if (document.documentElement.mozRequestFullScreen) {
      document.documentElement.mozRequestFullScreen();
    } else if (document.documentElement.webkitRequestFullscreen) {
      document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
    } else if (elem.msRequestFullscreen) {
            elem.msRequestFullscreen();
    }


  } else {
    if (document.cancelFullScreen) {
      document.cancelFullScreen();
    } else if (document.mozCancelFullScreen) {
      document.mozCancelFullScreen();
    } else if (document.webkitCancelFullScreen) {
      document.webkitCancelFullScreen();
    } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        }
  }
}

 </script>

Sorry if this question has been answered. I haven't found the solution.

1条回答
等我变得足够好
2楼-- · 2020-04-14 07:47

According to this site the fullscreen API is not supported in IE. There seem to be no information on whether this is something that will be supported by IE11 either.

According to MDN's article on fullscreen it seems that this technique is still be very much experimental for most browsers.

You could also try this

Internet Explorer full screen mode?

Set window to fullscreen (REAL fullscreen; F11 functionality) by javascript

<script type="text/javascript">
    function max() {
        var wscript = new ActiveXObject("Wscript.shell");
        wscript.SendKeys("{F11}");
    }
</script>

if you really want to have the full screen in internet explorer.... Try giving the slider wiidth and height 100% in jquery.

查看更多
登录 后发表回答