30
11
When Chrome has crashed, it displays a warning (under the address bar) upon restart, offering to restore tabs. I'm launching chrome in kiosk mode and I don't want theses warnings to be displayed.
Is there a way to do this ?
30
11
When Chrome has crashed, it displays a warning (under the address bar) upon restart, offering to restore tabs. I'm launching chrome in kiosk mode and I don't want theses warnings to be displayed.
Is there a way to do this ?
17
You should run Chrome in Incognito Mode with this command:
chrome --incognito --kiosk http://127.0.0.1
Here they talk about running this command before starting Chrome to stop the Restore Bar from appearing:
sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' \
~/.config/google-chrome/Default/Preferences
9Yes, incognito works, but it disables cookies and cache, and (in my case) they are required. – Davide Andrea – 2017-10-01T23:44:16.907
I added the sed line in my cron file after @reboot – Aryeh Beitz – 2018-01-08T16:07:20.113
For me in Chrome 74 it seems to have moved to a different file and no longer has white space, but this worked: sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' "$HOME/.config/google-chrome/Local State"
– Greg Bray – 2019-05-08T22:27:21.790
incognito does the trick for me. – Olivier – 2011-01-27T15:40:10.693
22
Based on @MiQUEL's answer to this duplicate question:
There are a few approaches.
Incognito mode (--incognito
) helps, but it has several disadvantages, such as disabling the cache.
Passing --disable-infobars --disable-session-crashed-bubble
works in some versions of Chrome, but, as of Chrome 58, it no longer works. (Removing the --disable-session-crashed-bubble
was done as part of this issue; comments there suggest that the flag was intended to test the bubble feature and was not intended as an end-user feature to hide the Chrome warning).
The most reliable approach I've found is to manually edit Chrome's on-disk preferences. Here's how you do this on Linux. (Note that these instructions are for chromium-browser; Google Chrome itself uses ~/.config/google-chrome
instead of ~/.config/chromium
.)
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
Putting it all together with a couple of additional flags that have been helpful for kiosk mode in one Chrome version or another:
#!/bin/sh
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
chromium-browser --kiosk --no-default-browser-check --no-first-run --disable-infobars --disable-session-crashed-bubble "http://some_url/"
For some reasons tilde wasn't resolved for me, I had to use $HOME in I use lxsession autostart. – mark.sagikazar – 2017-11-13T14:05:16.177
12
--disable-infobars --disable-session-crashed-bubble
while true; do
chromium-browser --kiosk http://fotolia.com/ --no-first-run --touch-events=enabled --fast --fast-start --disable-popup-blocking --disable-infobars --disable-session-crashed-bubble --disable-tab-switcher --disable-translate --enable-low-res-tiling
sleep 10s;
done
1Confirmed, this works for me on Chromium 47 on Linux. – Sundae – 2015-12-09T15:42:13.573
1Did the trick for me. My Chromium ignored the "exited_cleanly" Preferences. – cljk – 2016-02-19T06:59:47.040
2doesn't work anymore (Chromium 65 on RaspberryPi) – david114 – 2018-12-13T09:54:52.783
7
This finally worked for me, and it's pretty simple:
That will lock the state of two variables, regardless of how Chromium was shut down:
Of course, only do that after you're done setting preferences
1
Please do not post the same answer to multiple questions. If the same information really answers both questions, then one question (usually the newer one) should be closed as a duplicate of the other. You can indicate this by voting to close it as a duplicate or, if you don't have enough reputation for that, raise a flag to indicate that it's a duplicate. Otherwise tailor your answer to this question and don't just paste the same answer in multiple places.
– DavidPostill – 2017-10-02T05:01:32.2003Repeated admonishments from moderator aside, unlike every other suggested solution for this problem, this one actually worked for me. So thank you for sharing it. – Justin Force – 2017-12-05T20:55:40.620
2This seemed like a great solution at first glance. The main problem is that when using this with WebDriver under Selenium, chromedriver complains (at least on a Windows node) that it can't write to the prefs file at startup, so it won't let you launch a session when the prefs file is read-only. – Scott Dudley – 2018-07-11T20:23:13.403
2+1 thanks for this. The command I used to lock the file: sudo chattr +i ~/.config/google-chrome/Default/Preferences
– Harrison Powers – 2019-05-28T19:10:24.310
5
I believe --restore-last-session
will also do the job.
Source: http://peter.sh/experiments/chromium-command-line-switches/
3
I have been trying to solve this problem for days. Incognito mode comes without cache, and changing Preferences file did not work for me.
Finally I have been able to solve by following steps below:
chrome://flags
url. Search for “Enable session restore bubble UI” and set it to Disabled.--kiosk --disable-infobars
options.1Looks like that flag no longer exists – AJ Richardson – 2018-02-23T18:12:33.503
0
--restore-last-session
argument when launching Chrome.
This is a probable duplicate of http://superuser.com/questions/461035/disable-google-chrome-session-restore-functionality. Even though this question is older, it has 10x fewer views and 3x fewer votes.
– nc4pk – 2015-07-23T00:31:10.860