【问题标题】:Launch Google Chrome in Fullscreen mode以全屏模式启动 Google Chrome
【发布时间】:2015-07-06 09:30:18
【问题描述】:

我需要每次在 asp.net webform 中以全屏模式 (F11) 自动启动 Chrome

和我们做 F11 键事件的时候一样。

【问题讨论】:

  • 我没有明白你想要做什么?在什么情况下全屏打开chrome?
  • 你是通过c#提问的吗?
  • 我在 asp.net 项目上。当我运行网络表单时,我需要全屏显示
  • @Litisqe Kumar 是的,我想用 C# 来做,JavaScript 还是 C# 容易吗?
  • 您无法全屏启动 Chrome。这需要用户同意。

标签: javascript c# asp.net webforms


【解决方案1】:

试试这个:

  <script type="text/javascript">
        function goFullscreen(id) {
            // Get the element that we want to take into fullscreen mode
            var element = document.getElementById(id);

            // These function will not exist in the browsers that don't support fullscreen mode yet, 
            // so we'll have to check to see if they're available before calling them.

            if (element.mozRequestFullScreen) {
                // This is how to go into fullscren mode in Firefox
                // Note the "moz" prefix, which is short for Mozilla.
                element.mozRequestFullScreen();
            } else if (element.webkitRequestFullScreen) {
                // This is how to go into fullscreen mode in Chrome and Safari
                // Both of those browsers are based on the Webkit project, hence the same prefix.
                element.webkitRequestFullScreen();
            }
            // Hooray, now we're in fullscreen mode!
        }
</script>

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="goFullscreen('Button1'); return false"/>

点击按钮时会显示如下

【讨论】:

  • 那不是全屏。这只是一个调整大小的窗口模式。
  • 我已经更新了答案。检查它,让我知道它是否正常工作。
  • 但它正在工作。我已经在 Google chrome 版本(43.0.2357.130 m)中测试过
  • 我能做到吗页面加载
  • 我认为在页面加载时不可能触发它,因为它需要附加到页面元素上的事件处理程序(例如按钮单击)。但至少尝试调用 Button1.OnClientClick = "goFullscreen('Button1'); return false";在页面加载时
猜你喜欢
  • 1970-01-01
  • 2013-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-10
  • 2014-05-21
  • 1970-01-01
  • 2011-12-22
相关资源
最近更新 更多