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 ?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityWhen 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 ?
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
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' "$HOME/.config/google-chrome/Local State"
May 8, 2019 at 22:27
$HOME/.config/google-chrome/Local State
and exited_cleanly
is true.
Dec 23, 2022 at 10:37
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/"
--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
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
sudo chattr +i ~/.config/google-chrome/Default/Preferences
May 28, 2019 at 19:10
I believe --restore-last-session
will also do the job.
Source: http://peter.sh/experiments/chromium-command-line-switches/
Note that this does not force automatic session restore following a crash
.
Sep 22, 2020 at 14:31
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.On Linux I prevent the crash dialog by removing write access to the "Local State" file in the user profile.
Actually I run many instances of chrome with different user profile folders. Sometimes I run a script to kill all chrome processes for cleanup purposes. I used to get the annoying dialogs at restart and fixed it this way:
find /somepath/profiles/ -maxdepth 2 -type f -name "Local State" -exec chmod -w '{}' \;
pkill -9 chrome
find /somepath/profiles/ -maxdepth 2 -type f -name "Local State" -exec chmod +w '{}' \;
If you want to prevent the dialog after an uncontrolled crash, maybe you should remove write access for good. I don't know if it can have negative consequences though, never tried that.
For others looking for a current answer, I found the following tip on stackexchange that worked for me: chromium-browser --kiosk --app=http://your.url.here
Finally something that seems to work and ignore the crash (caused by powering the pi instead of a shutdown/restart).
The --app= seems to do the trick from the pi autostart file.
chromium-browser --start-fullscreen --kiosk --app=http://mumti.org/?ch=MUMTI&cat=SLOWTV
--app mentioned here Starting Google Chrome in application mode
One of my previous failed attempts was using sed from the autostart to modify Preferences and "Local State". I have no idea why it did not work on /home/pi/
The last successful solution was https://superuser.com/a/1643107/690627 although this brute force worked I hated it because