Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open two instances of Chrome kiosk mode in different displays (Windows)

Tags:

We are developing a web application that needs to open in two different browser instances each on a different Screen. Obviously the pc we are using has dual display already, and both monitors have the same size and resolution.

The idea is that as soon as Windows starts the two applications should open immediately in fullscreen, our preferred browser is Chrome as it counts with several commands that might help us accomplish the task.

We have succeeded on adding to the startup programs two shortcuts that open two instances in kiosk mode, but we have not been able to choose on which Display to open.

The shortcuts have this target:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=c:\temp --kiosk www.domain.com --new-window "%1" --window-position=0,0  "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=c:\temp --kiosk www.domain2.com --new-window "%2" --window-position=1680,0 

In order to open two instances chromes needs to create a temporary file with information of the instance to open (--user-data-dir=c:\temp)

We tried using (--window-position=1680,0) to specify where to open the instance but it seems that Chrome will give priority to the last position where the last instance was opened, so both instances open on the same window regardless of the command.

We found this site with a list of all the commands available but the list is huge and we don't even know what we are looking for:

http://peter.sh/experiments/chromium-command-line-switches/

I found this command: --display=:0.0 | --display=:0.1 But it doesn't seem to work or I am not using it properly

Any ideas? Thanks.

like image 680
multimediaxp Avatar asked Mar 27 '15 05:03

multimediaxp


2 Answers

This code worked fine for me:

start C:\Users\terminal\AppData\Local\Google\Chrome\Application\chrome.exe --app="http://www.domain1.com" --window-position=0,0 --kiosk --user-data-dir=c:/monitor1  start C:\Users\terminal\AppData\Local\Google\Chrome\Application\chrome.exe --app="http://www.domain2.com" --window-position=1680,0 --kiosk --user-data-dir=c:/monitor2 

I think the order of the parameters is relevant.

like image 81
serxio Avatar answered Sep 19 '22 19:09

serxio


I have the same issue also. This answer: https://stackoverflow.com/a/3750187/1305565 inspired me to create own PowerShell script for easier use.

  • You may download the solution at GitHub: Tomin.Tools.KioskMode.zip
  • Steps how to use it - on the main page of the GitHub project or
  • Complete Description is available as WordPress Blog article: https://alextomin.wordpress.com/2015/04/10/kiosk-mode-in-windows-chrome-on-multiple-displays/

Shortly

Script does the following:

  1. Start a Chrome instance via script
  2. Now use WinApi to find started window and move it to the desired screen
  3. Send F11 key to the moved window to make it full screen (we could start chrome already in full screen mode, but moving windows in that mode would be not so trivial)
  4. Do the same with other instances, specifying necessary URL.

Final script

Function definitions are hidden in Dll and in another helper script. (download them from GitHub using the link above)

$chromePath = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' $chromeArguments = '--new-window --incognito'  # &taskkill /im chrome* /F  Chrome-Kiosk 'http://google.com' -MonitorNum 1  Chrome-Kiosk 'http://http://www.bbc.com/' -MonitorNum 2  
like image 42
Oleksandr Avatar answered Sep 16 '22 19:09

Oleksandr