7

how to detect if the user using Google Chrome in kiosk mode?

I want to know if the user is using chrome in kiosk mode if it is not for me to display a message to put teaching so she can use the resources that only the kiosk mode can provide

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

10

You can check the isKioskSession property on the launchData object you get from the chrome.app.runtime.onLaunched event.

chrome.app.runtime.onLaunched.addListener(function(launchData) {
  if (launchData.isKioskSession) {
      // yes, we are in kiosk mode
  }
});

EDIT

The above answer assumes that you are in a Chrome app. If you are trying to detect whether a page is in a Chrome browser launched with the --kiosk option, I don't know of a way to detect that. However, this is functionally equivalent to running in fullscreen mode, which you can detect with the Fullscreen API.

var fullscreenEnabled = document.fullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled;
Sarah Elan
  • 2,465
  • 1
  • 23
  • 45
  • 2
    I think he was talking about normal Chrome running in Kiosk mode, not a Chrome app. The detect fullscreen code you mentioned is just for checking if the browser **supports** fullscreen, not if it's currently in fullscreen. Any other solutions? I have the same problem and detecting based on `screen.availHeight` and `window.innerHeight` doesn't work if the user zooms in, making it break. – s1h4d0w Jun 02 '17 at 07:10
  • mmm but if i want url bar to be visible i want to use --kiosk so no full screen, your solution may work with --kiosk-printing – shareef Nov 28 '17 at 18:13