How to exit F11 browser in full screen using javascript

Is there a way to exit the full screen mode that was created with F11 ?

 FullScreen: { _callback: null, enabled : function () { return document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled; }, request: function (i) { if (i.requestFullscreen) { i.requestFullscreen(); } else if (i.webkitRequestFullscreen) { i.webkitRequestFullscreen(); } else if (i.mozRequestFullScreen) { i.mozRequestFullScreen(); } else if (i.msRequestFullscreen) { i.msRequestFullscreen(); } }, element: function () { return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; }, exit: function () { if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.msExitFullscreen) { document.msExitFullscreen(); } }, onChange: function (fn) { if (document.fullscreenEnabled) document.addEventListener('fullscreenchange', fn); else if (document.webkitFullscreenEnabled) document.addEventListener('webkitfullscreenchange', fn); else if (document.mozFullScreenEnabled) document.addEventListener('mozfullscreenchange', fn); else if (document.msFullscreenEnabled) document.addEventListener('MSFullscreenChange', fn); }, removeOnChange: function (fn) { if (document.fullscreenEnabled) document.removeEventListener('fullscreenchange', fn); else if (document.webkitFullscreenEnabled) document.removeEventListener('webkitfullscreenchange', fn); else if (document.mozFullScreenEnabled) document.removeEventListener('mozfullscreenchange', fn); else if (document.msFullscreenEnabled) document.removeEventListener('MSFullscreenChange', fn); }, }, 

when in full screen using F11 :
Fullscreen.element() undefined and Fullscreen.exit() has no effect.

I tried in the latest version of Firefox and chrome.

Please, I will be a tank if you limit your comment / response to related and constructive answers. Your personal opinion is not required or requested.

Please do not post links to JS Fullscreen solutions, I can already do this, see the code.

0
javascript html fullscreen
source share

No one has answered this question yet.

See similar questions:

8
Fullscreen API not working on startup with F11

or similar:

7728
How to redirect to another web page?
7649
How do JavaScript locks work?
7494
How to remove a specific element from an array in JavaScript?
7432
How to check if a string contains a substring in JavaScript?
7428
How to check if an element is hidden in jQuery?
7287
What does use strict do in JavaScript, and what are the reasons for this?
5722
How to remove a property from a JavaScript object?
5670
Which operator is equal (== vs ===) should be used in comparing JavaScript?
4829
How to include a javascript file in another javascript file?
3998
How to check email address in JavaScript

All Articles