how do i prevent a user from exiting full screen mode in electron?

You probably want to use kiosk mode for you main window, and also disable the DevTools.

Please refer to the new BrowserWindow() documentation:

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.

Adding these settings should work, you may want to give it a try:

mainWindow = new BrowserWindow
(
    {
        // [...]
        kiosk: true,
        webPreferences:
        {
            // [...]
            devTools: false
        }
    }
);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top