What is Electron's 'kiosk' mode? - electron

What exactly does kiosk: true in the BrowserWindow config of a new ElectronJS window do?
The documentation just states that the parameter indicates, that the window is in 'kiosk' mode. I was unable to find information on what this means.

Basically, Kiosk mode is a Windows operating system (OS) feature that only allows one application to run. Kiosk mode is a common way to lock down a Windows device when that device is used for a specific task or used in a public setting.
So in electron kiosk mode, we'd have the ability to lock down our application to a point that users are restricted to the actions that we want them to perform. Also, the browser would merely act as our canvas with exactly defined capabilities and doesn't get into our way. And this is why you want to use Electron!

It's true that this feature is not very well documented. There is a open bug about it : Kiosk mode is poorly documented
This seems that the kiosk flags brings some like :
Disable the F11 key to exit full screen
Disable keyboard shortcuts for navigating or creating new tabs / windows
Prevents other programs from popping up on your screen
According to this article, but I was unable to replicate all behaviours.
I think that under the hood it's may be linked to the kiosk command line switch in chromium : --kiosk.

Related

Electron JS kiosk mode with touch screen

We are working on a customer facing electron app which should run in kiosk mode. The application runs on a touch enabled device with windows 10.
Even when the app is in kiosk mode, users can easily get into the OS by using the swipe gestures (Swipe left and Swipe right) of the OS.
What is the ideal way to lock down the app and prevent users from interacting with the OS?
There doesn't appear to be a way to disable touch screen gestures in Windows 10.
If you don't need the full node integration offered in electron, ie. your app could run entirely in Chrome you can run it from a cheap Android dongle and lock it down much more easily. I've done this a few times and there are apps which let you add a password, etc.
Alternatively, you could listen for the blur event on your BrowserWindow which is fired when your app loses focus. At that point you may be able to set it into the foreground again:
const mainWindow = require('electron').remote.getCurrentWindow();
mainWindow.on('blur', () => {
mainWindow.restore();
mainWindow.focus();
mainWindow.setKiosk(true);
});
I was able to disable touchscreen gestures for edge of screen by editing a group policy value:
RUN gpedit.msc from the Run box
Computer Configuration > Administrative Templates > Windows Components > EdgeUI > Allow Swipe: DISABLE
A method I've used since Windows 8, is to kill the explorer.exe process shortly after login. Achieved with a scheduled task, set to run 20-30 seconds after login, with a command like this:
taskkill /F /IM explorer.exe
If you need to work on the system, remote in or connect a keyboard and send CTRL + ALT + Del to bring up Task Manager. Go to File > Run new task. In the Create new task dialogue, enter explorer and hit Enter.
When done, reboot the system and all is back to normal.
What I've done to disable the swipe functionality of Windows is to launch our kiosk application instead of explorer.exe.
So, we often deal with multiple displays and many of our apps are written for chrome browser. That means an automated kiosk will have to run a script that launches full screen incognito/kiosk browser instances on two or more displays. We use AutoHotkey to automate the placement and fullscreening of displays, as well as running a watchdog script that monitors for possible browser crashes and popups.
Unintended defocusing by the OS is the last thing we want.
Anyway, to replace the explorer with your app, I've found this regedit to work:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"Shell"="D:\\path\\to\\your\\appFile.bat"
Copy that into a .txt file, rename the extension to .reg and run it.
To revert:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"Shell"="explorer.exe"
Since windows cannot run an .ahk file, we just run a .bat file that runs .ahk file, that in turn runs all the browsers and does all the other initialization magic.
For remote work, we do the same as user Bink mentioned: bring up run dialog and run explorer.exe. When done, reboot.
If you have windows Home and you don't have gpedit.msc
(even if you can install using https://www.itechtics.com/enable-gpedit-windows-10-home/)
I found this working solution:
https://www.tenforums.com/tutorials/48507-enable-disable-edge-swipe-screen-windows-10-a.html

How to get dev tools in built electron app?

Is it possible to show the dev tools within a built electron app? The executable that I built using electron-packager is behaving differently from the app run using electron at the command line, and I have no way to see what kinds of exceptions are being thrown.
Yes it's possible to show the DevTools in a packaged app, just call someBrowserWindow.webContents.openDevTools(). If you want a menu item and/or keyboard shortcut to do it then you'll need to create and set your own menu for the browser window using someBrowserWindow.setMenu(someMenu).

How to Programatically Turn on Guided Access on iPad/iOS Device?

I am currently automating an app for iPad that needs to be set in Guided Access mode to work. I'm using Java with Selenium webdriver inside Eclipse. The app is all setup and being deployed through Xcode and I can interact with it just fine with the iOS driver.
The problem is the user cannot login until the iPad is set to Guided Access mode on this app. I know you can turn it on by triple clicking the Home button very quickly but I have not found a way to do that using code inside my tests.
Is there a way to send keyevents specific to the iPad Home button OR is there a way to set Guided Access mode programatically? Maybe set it in the capabilities before the iOS driver/app launches?
I'm not aware of any way to send events to the home button (pretty sure this wouldn't be possible).
You can programmatically enable / disable guided access however, using UIAccessibilityRequestGuidedAccessSession. In order for this to work, your device must be supervised using MDM and have a profile installed that enables single app mode for your application.
More details here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/#//apple_ref/c/func/UIAccessibilityRequestGuidedAccessSession

Run silent print via Chrome App in Kiosk mode

Does anyone know a way to silent print via a Chrome App?
I'm developing a chrome app for a KIOSK system which runs Chromium OS. I need to print a receipt via a Chrome App, which I already did. The problem is that print dialog box appears once print process is started.
Is there any way around this?
This is IMPORTANT INFORMATION about kiosk mode Chrome app
Kiosk parameters can not be useful when you install app in developer mode (1) ( Parameters = "kiosk_enabled":true and "kiosk_only":true located in manifest.json )
But the parameters work after install the app from Chrome Store. Therefore be careful about this trick.
Now my kiosk app can run full screen and silent print (without preview).
1) http://lifehacker.com/install-chrome-extensions-from-outside-the-store-with-d-1596918011?disableinsets=off&utm_expid=66866090-49.VYy4WCNHSyuP6EmjnM93MQ.1&utm_referrer=https%3A%2F%2Fwww.google.com.sa%2F
I found a temporary (maybe not temporary :) ) solution for this subject:
SOLUTION FOR CHROME APP
Install your App to chrome
Create shortcut from this app to desktop.
Right click > Properties > Edit Target Textbox like the below (you will add "--kiosk-printing" parameter )
Before Edit: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 2" --app-id=eoaefbbbpgcbhgeilphgobiicboopknp
After Edit: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --kiosk-printing --profile-directory="Profile 2" --app-id=eoaefbbbpgcbhgeilphgobiicboopknp
Absolutely restart chrome for effect (close every tabs and windows on chrome)
Try to print
If you want to remove default header and footer (page address and date) : Open normal chrome print something > on printer preview > More Settings > uncheck "Header and Footer". Chrome ll remember this settings always.
(In fact chrome must provide this property on manifest.json too, but i couldnt find yet)
If you're specifically targeting Kiosk mode apps, you just need to set a flag.
Specifically, --kiosk-printing
I'm not 100% sure how to do that on a Chrome OS device in Kiosk mode. Maybe you need to set it at chrome://flags before switching to Kiosk mode.
Sorry man, it's not possible.
But you could evaluate some workaround: install a web server, make an httpRequest, and then print using a server side language.
In my case, I used php to receive the http request from the chrome app, and then, from php, I launched a java app for the print. I used java because with php (php_printer.dll) is not possible to print images (it's possible to print bmp, but the process to convert a png to an bmp is too long).
I know, it's a little tricky, but it works.

Disable deleting application by tap-and-hold

Usually on a long press of a third-party application icon, it will give you the option to delete the app. Is there any way to disable that option, the way it seems to be with the preloaded applications on iPhone?
It's not possible to do it from within the app.
You could, however, configure the parental settings on the device to disallow removing applications (Settings -> General -> Restrictions), but you would need to do it on each device you want the feature enabled, and the setting will apply for all third party apps, not only yours.
Nope, you can't disable it. If you're developing some enterprise application where the iPad is supposed to run only your app and nothing else, I suggest getting a case or something along those lines to block the "home" button on the iPad.

Resources