19 年 10 月 3 日更新
显示 10 秒倒计时的新脚本,然后以全屏信息亭模式启动 chrome/chromiumn。
对 chrome 的更多更新需要脚本更新以允许自动播放带音频的视频。注意 --overscroll-history-navigation=0 当前不工作需要通过在浏览器中转到 chrome://flags/#overscroll-history-navigation 并设置为禁用来禁用此标志.
@echo off
echo Countdown to application launch...
timeout /t 10
"C:\Program Files (x86)\chrome-win32\chrome.exe" --chrome --kiosk http://localhost/xxxx --incognito --disable-pinch --no-user-gesture-required --overscroll-history-navigation=0
exit
如果运行旧版本的 chrome(60 以下),可能需要设置 chrome://flags/#autoplay-policy
2016 年 5 月 11 日更新
自从我发布此内容以来,chrome 已经进行了许多更新,并且不得不对脚本进行大量更改以使其按我的需要工作。
较新版本的 chrome 存在几个问题:
- 内置双指缩放
- 强制关机后始终显示 Chrome 恢复错误
- 自动更新弹出窗口
由于还原错误切换到隐身模式,因为这始终会启动一个清晰的版本并且不会保存用户正在查看的内容,因此如果它崩溃,则没有任何内容可还原。此外,较新版本的 chrome 中的 auto up 很难尝试禁用,我转而使用 chromium,因为它不会自动更新,并且仍然提供 chrome 的所有现代功能。请注意确保您下载所有音频和视频编解码器随附的 chromium 顶级版本,因为 chromium 的基本版本不支持所有编解码器。
Chromium download link
@echo off
echo Step 1 of 2: Waiting a few seconds before starting the Kiosk...
"C:\windows\system32\ping" -n 5 -w 1000 127.0.0.1 >NUL
echo Step 2 of 5: Waiting a few more seconds before starting the browser...
"C:\windows\system32\ping" -n 5 -w 1000 127.0.0.1 >NUL
echo Final 'invisible' step: Starting the browser, Finally...
"C:\Program Files (x86)\Google\Chromium\chrome.exe" --chrome --kiosk http://127.0.0.1/xxxx --incognito --disable-pinch --overscroll-history-navigation=0
exit
过时
我在展览中使用它来锁定屏幕。我想它就是你要找的东西。
- 启动 chrome 并转到 www.google.com 将网址拖放到桌面上
- 将其重命名为本示例方便的名称 google_homepage
- 现在把它放到你的 c 目录,点击我的电脑 c: 然后把这个文件放到那里
- 再次启动 chrome 进入设置并在 on start up 下选择打开特定页面并在此处设置您的主页。
下一部分是我用来在 kiosk 模式下开始关闭和重新启动 chrome 的脚本。这些位置是我安装 chrome 的位置,因此根据您的安装情况,它可能会有所不同。
打开您选择的文本编辑器或只是记事本并输入以下代码,确保其格式/顺序与以下相同。将它保存到您的桌面上,如本例中的任何您喜欢的那样 chrome_startup_script.txt 下一步右键单击它并重命名,从末尾删除 txt 并放入 蝙蝠代替。双击它来启动脚本,看看它是否工作正常。
应该出现一个命令行框并通过脚本运行,chrome 将启动然后关闭这样做的原因是删除任何错误报告,例如如果 pc 崩溃了,当 chrome 再次启动时它会显示顶部的黄色错误栏显示 chrome 未正确关闭,您要恢复它吗?几秒钟后,chrome 应该会重新启动并处于 kiosk 模式,并将指向您设置的任何主页。
@echo off
echo Step 1 of 5: Waiting a few seconds before starting the Kiosk...
"C:\windows\system32\ping" -n 31 -w 1000 127.0.0.1 >NUL
echo Step 2 of 5: Starting browser as a pre-start to delete error messages...
"C:\google_homepage.url"
echo Step 3 of 5: Waiting a few seconds before killing the browser task...
"C:\windows\system32\ping" -n 11 -w 1000 127.0.0.1 >NUL
echo Step 4 of 5: Killing the browser task gracefully to avoid session restore...
Taskkill /IM chrome.exe
echo Step 5 of 5: Waiting a few seconds before restarting the browser...
"C:\windows\system32\ping" -n 11 -w 1000 127.0.0.1 >NUL
echo Final 'invisible' step: Starting the browser, Finally...
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --kiosk --overscroll-history-navigation=0"
exit
注意: ping 的 -n 后面的数字是在启动链接(或下一行中的应用程序)之前等待的秒数(减去一秒) em>
最后,如果一切正常,您可以将 .bat 文件拖放到 windows 的启动文件夹中,每次 windows 启动时都会启动此脚本。
更新:
在最新版本的 chrome 中,他们确实启用了触摸手势,这意味着在触摸屏上向左或向右滑动会导致浏览器在历史上前进或后退。为了防止这种情况,我们需要禁用后退和前进按钮上的历史导航,以便在脚本末尾添加以下 --overscroll-history-navigation=0。