electron - 防止用户在 Electron 中退出全屏模式到窗口模式?

标签 electron window fullscreen chromium devtools

我正在开发一个桌面应用程序,它的所有窗口始终全屏显示,我不希望用户能够退出到窗口模式。我已经搜索了它,但没有找到任何东西,有什么想法吗?
另外,我可以阻止用户打开 DevTools 之类的东西(默认情况下来自 Chrome 和 Electron 的东西)吗?

最佳答案

您可能想使用 售货亭 主窗口的模式,并禁用 DevTools。
请引用new BrowserWindow()文档:

options Object (optional)

kiosk Boolean (optional) - Whether the window is in kiosk mode. Default is false.

webPreferences Object (optional) - Settings of web page's features.

devTools Boolean (optional) - Whether to enable DevTools. If it is set to false, can not use BrowserWindow.webContents.openDevTools() to open DevTools. Default is true.



添加这些设置应该可以工作,您可能想尝试一下:
mainWindow = new BrowserWindow
(
    {
        // [...]
        kiosk: true,
        webPreferences:
        {
            // [...]
            devTools: false
        }
    }
);

关于electron - 防止用户在 Electron 中退出全屏模式到窗口模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64709288/

相关文章:

javascript - Electron: require ('electron' 的语义是什么?

node.js - ExpressJS只接受6次POST?

c++ - 使用窗口而不是对话框的优势

android - 将opencv视频设置为全屏android

node.js - child_process.on ('close')有时会很慢

node.js - Electron-Builder:在MacOS上使用松鼠构建Windows安装程序失败

plugins - 终端中 zsh 顶部的固定行

html - 填充和边距导致我的 div 太宽

javascript - 如何在 Android 上以编程方式退出全屏视频?

python - 全屏 Python TKinter 或 wxPython 窗口,但所有窗口的 'stay at the bottom'?