28

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
  • incognito does the trick for me. – Olivier Jan 27 '11 at 15:40
  • 8
    Yes, incognito works, but it disables cookies and cache, and (in my case) they are required. – Davide Andrea Oct 1 '17 at 23:44
  • I added the sed line in my cron file after @reboot – Aryeh Beitz Jan 8 '18 at 16:07
  • 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 May 8 at 22:27
21

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 Nov 13 '17 at 14:05
11

--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
  • 1
    Confirmed, this works for me on Chromium 47 on Linux. – Sundae Dec 9 '15 at 15:42
  • 1
    Did the trick for me. My Chromium ignored the "exited_cleanly" Preferences. – cljk Feb 19 '16 at 6:59
  • doesn't work anymore (Chromium 65 on RaspberryPi) – david114 Dec 13 '18 at 9:54
6

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

  • 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 Oct 2 '17 at 5:01
  • 3
    Repeated 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 Dec 5 '17 at 20:55
  • 2
    This 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 Jul 11 '18 at 20:23
  • 1
    +1 thanks for this. The command I used to lock the file: sudo chattr +i ~/.config/google-chrome/Default/Preferences – Harrison Powers May 28 at 19:10
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:

  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.
  • Looks like that flag no longer exists – AJ Richardson Feb 23 '18 at 18:12
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.