35

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 ?

InterLinked
  • 2,635
Olivier
  • 1,549

10 Answers10

24

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/"
Josh Kelley
  • 1,615
20

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
jowido
  • 616
13

--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
frekele
  • 231
8

This finally worked for me, and it's pretty simple:

  1. Shut down Chromium gracefully
  2. Change the "Change content" permissions of ~/.config/chromium/Default/Preferences to "Nobody"

That will lock the state of two variables, regardless of how Chromium was shut down:

  • "exit_type": "Normal"
  • "exited_cleanly": true

Of course, only do that after you're done setting preferences

4

I believe --restore-last-session will also do the job.

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

Gili
  • 1,901
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:

  1. Go to chrome://flags url. Search for “Enable session restore bubble UI” and set it to Disabled.
  2. open chrome with --kiosk --disable-infobars options.
yjcxy12
  • 131
2

--restore-last-session argument when launching Chrome.

Matt
  • 298
1

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.

xtian
  • 306
0

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

R Rust
  • 1
0

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

  1. a simple chromium command line option would have sufficed.
  2. I am still in the midst of fine tuning things so having to unlock these files is unpleasant.
  3. locking files is probably a bad idea as it may crash chromium
Meryan
  • 232