如何在不同显示器中打开Chrome kiosk模式的两个实例(Windows) [英] How to open two instances of Chrome kiosk mode in different displays (Windows)

查看:979
本文介绍了如何在不同显示器中打开Chrome kiosk模式的两个实例(Windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发一个Web应用程序,需要在两个不同的屏幕上分别打开两个不同的浏览器实例。显然,我们正在使用的电脑已经有双显示屏,而且两台显示器的尺寸和分辨率都是相同的。



这个想法是,只要Windows启动,两个应用程序应该打开立即在全屏模式下,我们首选的浏览器是Chrome浏览器,因为它可以帮助我们完成任务。我们已经成功地向启动程序添加了两个快捷方式,它们可以帮助我们完成这项任务。 在信息亭模式下打开两个实例,但我们无法选择打开哪个显示。



快捷键有这个目标:

 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:\程序文件(x86)\ Google\\Chrome\Application\chrome.exe--user-data-dir = c:\temp --kiosk www.domain2.com - 新窗口%2--window-position = 1680 ,0

为了打开两个实例,chromes需要创建一个包含实例信息的临时文件,以打开( - user-data-dir = c:\temp) $ b

我们尝试使用( - window-position = 1680,0 )来指定何处打开实例,但似乎Chrome会优先考虑最后一个实例打开的位置,所以无论命令如何,两个实例都会在同一个窗口中打开。



我们发现这个网站列出了所有可用的命令,但是这个列表非常庞大,我们甚至不知道我们在寻找什么:



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



我发现这个命令: - display =:0.0 | --display =:0.1 但它似乎不起作用或者我没有正确使用它。



有什么想法?
Thanks。

解决方案

我也有同样的问题。这个答案: https://stackoverflow.com/a/3750187/1305565 激励我创建自己的PowerShell脚本,以便于使用。



不久
$ b

脚本执行以下操作:
$ b $ ol

  • 通过脚本启动Chrome实例

  • 现在使用WinApi来查找启动窗口a nd将其移动到所需的屏幕

  • 发送F11键到移动的窗口使其全屏(我们可以在全屏模式下启动Chrome,但在该模式下移动窗口不会如此简单)

  • 对其他实例执行相同操作,指定必要的URL。



    最终脚本



    函数定义隐藏在Dll和另一个辅助脚本中。 (使用上面的链接从GitHub下载)

      $ chromePath ='C:\程序文件(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


    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.

    解决方案

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

    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 
    

    这篇关于如何在不同显示器中打开Chrome kiosk模式的两个实例(Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆