1

I am unable to exit the full screen mode of IE using javascript.

Code for exiting full screen which i ma using is:

 docElement.msCancelFullScreen();

I also tried

 docElement.exitFullscreen();

I searches alot on web but nothing works for me.. Please help me..

Simranjeet Kaur
  • 259
  • 1
  • 6
  • 18

3 Answers3

3

You can't, IE10 and below don't support the FullScreen API. The user can easily exit it, but there's no IE API to do so. If there were an older, IE-specific API, they'd probably mention it here.


I will just note, though, that the ms-prefixed function for exiting full screen mode is msExitFullscreen, not msCancelFullScreen.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
  • If using "document.documentElement.msRequestFullscreen();" works for entering in full screen mode then why not it is possible to exit from full screen mode. – Simranjeet Kaur Aug 29 '14 at 12:27
  • @SimranjeetKaur: I don't think that *does* work for entering full screen mode on IE10 and earlier. – T.J. Crowder Aug 29 '14 at 12:30
  • 2
    I just tested in IE10 using MSFTs sample test page for the feature and it failed to enter full-screen. http://samples.msdn.microsoft.com/Workshop/samples/media/fullscreen/fullscreendemo.html – mccainz Aug 29 '14 at 12:47
1

You can try this:

<script type="text/javascript">
    function max() {
        var wscript = new ActiveXObject("Wscript.shell");
        wscript.SendKeys("{F11}");
    }
</script>
Greenonion
  • 87
  • 5
  • 2
    Should probably mention the Stack overflow answer you copied this directly from or better yet, link to it. – mccainz Aug 29 '14 at 12:25
  • Thanks, actually i copied this code from my notes i used to remeber such tricks. But after fast google i found similar question here: http://stackoverflow.com/questions/1125084/how-to-make-in-javascript-full-screen-windows-stretching-all-over-the-screen – Greenonion Aug 29 '14 at 12:28
  • @SimranjeetKaur What did you try? How did you implement this code? – Xanco Aug 29 '14 at 12:32
  • @SimranjeetKaur, i just tried on ie9: ` ` IE will ask about running unsafe content. You need to allow it to make it work. – Greenonion Aug 29 '14 at 13:00
0

THe fullscreen API you are using is IE11 specific. It will not work in IE10 or less. http://msdn.microsoft.com/en-us/library/ie/dn265028(v=vs.85).aspx

See Internet Explorer full screen mode? For a workaround.

Community
  • 1
  • 1
mccainz
  • 3,478
  • 5
  • 35
  • 45