Is there a way to exit the fullscreen that was created with hitting 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 fullscreen mode using F11
:
Fullscreen.element()
is undefined
and Fullscreen.exit()
has no effect.
tried in latest version of Firefox and chrome.
Please, I will be tankful if you limit the comment/answer to related and constructive answers. Your personal opinion is not required nor is requested.
Please don't post links to JS Fullscreen
solutions, I am already able to to that, see the code.