How to hide chrome warning after crash?
Solution 1
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
Solution 2
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/"
Solution 3
--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
Solution 4
This finally worked for me, and it's pretty simple:
- Shut down Chromium gracefully
- 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
Solution 5
I believe --restore-last-session
will also do the job.
Source: http://peter.sh/experiments/chromium-command-line-switches/
Related videos on Youtube
Olivier
Updated on September 17, 2022Comments
-
Olivier almost 2 years
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 ?
-
Olivier over 13 yearsincognito does the trick for me.
-
Sundae over 8 yearsConfirmed, this works for me on Chromium 47 on Linux.
-
cljk over 8 yearsDid the trick for me. My Chromium ignored the "exited_cleanly" Preferences.
-
Davide Andrea over 6 yearsYes, incognito works, but it disables cookies and cache, and (in my case) they are required.
-
DavidPostill over 6 yearsPlease 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.
-
mark.sagikazar over 6 yearsFor some reasons tilde wasn't resolved for me, I had to use $HOME in I use lxsession autostart.
-
Justin Force over 6 yearsRepeated admonishments from moderator aside, unlike every other suggested solution for this problem, this one actually worked for me. So thank you for sharing it.
-
Aryeh Beitz over 6 yearsI added the sed line in my cron file after @reboot
-
AJ Richardson over 6 yearsLooks like that flag no longer exists
-
Scott Dudley almost 6 yearsThis 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.
-
david114 over 5 yearsdoesn't work anymore (Chromium 65 on RaspberryPi)
-
Greg Bray about 5 yearsFor 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"
-
Harrison Powers about 5 years+1 thanks for this. The command I used to lock the file:
sudo chattr +i ~/.config/google-chrome/Default/Preferences
-
caesarsol almost 4 yearsactually in that page it says
Note that this does not force automatic session restore following a crash
. -
Meryan about 3 yearswhat is the command to remove write access to the stupid chromium, I tried resetting both variables in that Preferences file I hard boot (repower) my Raspberry pi, I keep getting this nasty popup. I also tried the --disable-session-crashed-bubble in the pi autostart when launching chromium. Thanks. cd ~/.config/chromium/Default then what
-
xtian about 3 years@Meryan isn't my example working for you? Maybe with chmod a-w instead of just -w?
-
Meryan about 3 yearsSo after exiting manually from Chrome via Ctrl-F4 I greped the json and it shows both exit flags as Normal/true I ran chmod -w ~/.config/chromium/Default/Preferences went back to the Pi launched Chromium from the GUI. Than hit the power switch on reboot I still get the popup. I am unix novice I don't understand your script /somepath/profiles/ that is apply to me as well? I have only the default user on the raspberry pi
-
Meryan about 3 yearschromium is somehow able to change the access rights on the Preferences file. I see the access writes are back as -rw------ instead of -r--------- after the chmod -w
-
Meryan about 3 yearsI run chromium from the pi autostart as follows: chromium-browser --start-fullscreen --disable-session-crashed-bubble --kiosk http mydomain.com
-
xtian about 3 yearsThe file that I set to readonly is called "Local State" (yes, with a space) and resides in the user profile folder. If you don't know where your user profile folder is, then start chrome with a specific user profile folder: --user-data-dir=/some/folder/here
-
Meryan about 3 yearsTried chmod -w ~/.config/chromium/'Local State' after cleaning, chromium has super power it changes it to -rw---------------------------- I have now posted my wasted time here superuser.com/questions/1640618/…
-
xtian about 3 yearsMaybe you can start chromium with a different user that has less privileges?
-
Meryan about 3 yearssuperuser.com/a/1643107/690627 This brute force worked but I hate it when a simple command line option would have sufficed. I am still in the midst of fine tuning things so having to unlock these files is unpleasant. I have no idea why sed from the autostart modifying Preferences and "Local State" does not work on /home/pi/... what am I missing?