Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove press esc to exit full screen in firefox and chrome?

I used this JavaScript code to full screen the page:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <div style="border:1px solid red;height:100px;width:100px;background-color:red;" onclick="requestFullScreen(document.body)"></div>
    <div style="border:1px solid red;height:100px;width:100px;background-color:blue;" onclick="exitFullScreen(document.body)"></div>

    <script>
        function requestFullScreen(element) {
            // Supports most browsers and their versions.
            var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullscreen;

            if (requestMethod) { // Native full screen.
                requestMethod.call(element);
            } else if (typeof window.ActiveXObject !== "undefined") { // Older IE.
                var wscript = new ActiveXObject("WScript.Shell");
                if (wscript !== null) {
                    wscript.SendKeys("{F11}");
                }
            }
        }

    </script>

    <script>
        function exitFullScreen() {
            if (document.exitFullscreen) {
                document.exitFullscreen();
            }
            else if (document.msExitFullscreen) {
                document.msExitFullscreen();
            }
            else if (document.mozCancelFullScreen) {
                document.mozCancelFullScreen();
            }
            else if (document.webkitCancelFullScreen) {
                document.webkitCancelFullScreen();
            }
        }

    </script>
</body>
</html> 

but it show "press esc to exit full screen" in full screen mode. How to remove "press esc to exit full screen" in firefox and chrome?

like image 646
Mike Avatar asked Nov 17 '25 17:11

Mike


1 Answers

It's super easy in Firefox:

  1. In the URL bar enter about:config
  2. Agree to the security risks
  3. Search for the entry browser.fullscreen.exit_on_escape
  4. Double click on true to change it to false
  5. You're done! Enjoy :-)
like image 84
GregorMakesLifeEasy Avatar answered Nov 20 '25 06:11

GregorMakesLifeEasy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!