禁用页面加载 asp.net C# 时的窗口任务栏



我正在开发一个应用程序,其中用户要求在页面加载后禁用窗口任务 asp.net .i 正在将 asp.net 与 C# 一起使用。

请帮助我

您可以使用javascript函数完成此任务,如下所示。

<script type="text/javascript">
    window.onload = maxWindow;
    function maxWindow() {
        window.moveTo(0, 0);

        if (document.all) {
            top.window.resizeTo(screen.availWidth, screen.availHeight);
        }
        else if (document.layers || document.getElementById) {
            if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {
                top.window.outerHeight = screen.availHeight;
                top.window.outerWidth = screen.availWidth;
            }
        }
    }
</script> 
  • 将上面的代码放在您.aspx页面中的<head>标签中。

您可以使用HTML5 API进行全屏模式 点击这里

更新的答案如果上面的代码不起作用,请尝试使用以下代码强制"F11"键事件。

function requestFullScreen(element) {
    var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullscreen;
    if (requestMethod) { 
        requestMethod.call(element);
    } else if (typeof window.ActiveXObject !== "undefined") { 
        var wscript = new ActiveXObject("WScript.Shell");
        if (wscript !== null) {
            wscript.SendKeys("{F11}");
        }
    }
}
var elem = document.body; 
requestFullScreen(elem);

最新更新