简体   繁体   English

如何删除按 esc 以在 Firefox 和 chrome 中退出全屏?

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

I used this JavaScript code to full screen the page:我使用这个 JavaScript 代码来全屏显示页面:

<!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.但它在全屏模式下显示“按 esc 退出全屏”。 How to remove "press esc to exit full screen" in firefox and chrome?如何在firefox和chrome中删除“按esc退出全屏”?

You can't. 你不能 It's a security feature designed to not let malicious sites mislead or trap a user - it's not something you can remove. 这是一项旨在防止恶意网站误导或诱骗用户的安全功能-您不能删除该内容。

it is supereasy - in firefox超级简单 - 在 Firefox 中

  1. in the url bar write "about:config"在网址栏中写“about:config”
  2. agree with security risks同意安全风险
  3. search for "escape", it should find the entry "browser.fullscreen.exit_on_escape"搜索“escape”,它应该找到条目“browser.fullscreen.exit_on_escape”
  4. doulbe click on "true", it should go to "false"双击“true”,它应该转到“false”

you´re done - enjoy :-)你完成了 - 享受:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM