1

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.

Exlord
  • 4,250
  • 2
  • 26
  • 38
  • 2
    This *fullscreen* window mode is OS dependent, only at an app level, and not tied to any API available to us poor web-devs. The fullscreen API, which should be flattened by clear specs, is already an nightmare (look at the 60 lines you got for only 3 methods of this API), but this... You won't find any cross-browser/cross-OS hack (I don't even know any for my own browser/OS). The only way you could get something would be through an more powerful API, giving you an application access to the browser's window. It is possible that `chrome:` APIs (plugins) do have such an API. For web, you're stuck – Kaiido May 23 '17 at 12:01
  • 1
    And if this `chrome:` level APIs interest you, https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/windows/update is what you need. – Kaiido May 23 '17 at 12:18

0 Answers0