google-chrome - 如何在 Electron 中启用 "Press ESC to exit full screen mode"

标签 google-chrome iframe electron chromium

如何在 中启用“按 ESC 退出全屏模式消息” Electron 当我在 iframe 中全屏显示时?

2019-11-06_13-01-16

观察 :在 Chrome 中具有相同选项的相同 iframe 会显示消息,但 Electron 不会。

最佳答案

最简单的方法是使用 remote 进行一些简单的窗口控制。模块。

const remote = require("electron").remote;

document.addEventListener("keydown", event => {
    switch (event.key) {
        case "Escape":
            if (remote.getCurrentWindow().isFullScreen()) {
                remote.getCurrentWindow().setFullScreen(false);
            }
            break;
         }
});

代码和原始答案hereZen .

关于google-chrome - 如何在 Electron 中启用 "Press ESC to exit full screen mode",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58731443/

相关文章:

javascript - Chrome 上的 iframe 高度问题

javascript - 新的 Electron 浏览器窗口从指定的 ui-router 状态开始

jquery - 单击图像不会在 chrome 中加载

html - 视网膜屏幕上的 Chrome 渲染伪影

javascript - 我可以在新标签页上运行用户脚本吗?

google-chrome - 为什么 iframe 请求不发送 cookie?

javascript - 如何删除右键单击上下文菜单 chrome 和 firefox

css - Iframe 中的网页在没有 css 的情况下显示?

AngularJS:在 Electron 中检索 mysql 数据并将其发布到 AngularJS 范围

electron - 给BrowserWindow时间以应用样式更改