Opening the page so a visitor cannot leave it
You do not need a special "kiosk browser". Edge and Chrome are already on every Windows machine and
will do it. deployment/start_kiosk_window.ps1 is our implementation of everything below; run that
rather than assembling it yourself, and read this to understand what it does.
Use --kiosk, and place the window yourself. Everyone gets this wrong in one direction or the
other:
|
|
msedge.exe --kiosk "http://127.0.0.1:8080/"
--user-data-dir="%LOCALAPPDATA%\KioskTablet"
--no-first-run --noerrdialogs --disable-session-crashed-bubble
--disable-pinch --overscroll-history-navigation=0
Call SetWindowPos(hwnd, HWND_TOPMOST, x, y, w, h, SWP_NOACTIVATE | SWP_SHOWWINDOW) on the
browser’s window once it appears.
Four details that each cost an afternoon if you skip them:
-
--user-data-diris not optional. Without a profile of its own, a second launch simply hands the URL to the already-running browser and silently ignores everything else you asked for. -
Ask Windows where the monitor is; never hardcode coordinates. A display placed to the left of the main one has negative coordinates, and anyone can rearrange them in Display Settings.
-
--disable-session-crashed-bubble, or every power cut leaves a "Restore pages?" bubble sitting on the tablet with nobody to dismiss it. -
SWP_NOACTIVATE, andSW_SHOWNOACTIVATEif you restore the window. On a one-PC installation, Unreal is fullscreen on the other display. Taking the foreground from a fullscreen D3D window is a good way to make it minimise itself.
Then keep watching the window. Closing it kills the process and a supervisor brings it back, but minimising it does not. The process stays perfectly healthy behind a black touchscreen, and every health check on the box still reads green. A one-second loop that restores and re-places the window turns this outage into a flicker. Ours does this; if you write your own, do not skip it.
The browser cannot lock down the machine around it, so change a few Windows settings on a real
kiosk: taskbar off the touchscreen, edge swipes off, notification toasts off, screensaver and sleep
off. deployment/kiosk-24-7-setup.bat applies the set we use.
The page itself must also declare <meta name="google" content="notranslate">. Otherwise, Edge
offers to translate the kiosk via a corner bubble that a visitor cannot be expected to dismiss, and
the browser flag disabling Chromium’s translate does not reach Edge’s own.