Disable Google Chrome session restore functionality

60

14

Chrome offers to restore the last session when it did not shutdown properly (power outage, Chrome crashed, ...).

How do I disable that? (Setting or command line switch)

I'm using a batch file that starts (among other things) chrome in kiosk mode for a single page on windows startup. Even after power outage etc. it should only launch that page without the ruckus.

riha

Posted 2012-08-13T12:34:33.990

Reputation: 711

Question was closed 2015-07-29T13:55:14.773

@janot and other closevoters: this question is more highly upvoted and has a lot more views than the linked duplicate. I've voted to close the older, less-viewed one as a duplicate. – nc4pk – 2015-07-23T00:28:48.377

@ncdownpat I guess thats because most people search for "chrome disable session restore", not "chrome crash warning" or the like. At least that's why I created a new question back then - I didn't find the other one. Anyhow, my first gold badge =) – riha – 2015-08-07T11:45:21.047

1It might not be possible to disable it. If you are using a batch file, I would simple delete the file that handles the session, before you launch Chrome. – Ramhound – 2012-08-13T12:40:36.290

@Ramhound Which file(s) would that be? "User Data\Default\Current Session" and "User Data\Default\Current Session" don't seem to make a difference. Neither does "User Data\chrome_shutdown_ms.txt". – riha – 2012-08-13T13:04:25.353

@riha simply clearing history and sessions before closing the browser will solve your problem and there were some third party tools which would automatically wipe history when your system is restarted – BlueBerry - Vignesh4303 – 2012-08-13T13:04:54.467

A power outage prevents clearing history / sessions. Deleting the whole profile folder works, but that feels like a bit too much... – riha – 2012-08-13T13:30:47.213

Answers

42

I know this is old but I thought it would be helpful to others that may come across this.

I had this issue and tried the flags settings but that did not help. adding --incognito to the command did resolve the issue.

chrome.exe --kiosk --incognito some.web.site

I tried this in various fashions of crashing Chrome and pulling the power to the PC. In all tests the system would power up and go into kiosk mode without the frown face error message.

rscrash

Posted 2012-08-13T12:34:33.990

Reputation: 444

This disables any extensions you have set up. – André Christoffer Andersen – 2019-06-27T06:43:19.533

1Is this any different than @Dom's answer? – Andrew Lott – 2013-07-12T13:39:23.213

8note, incognito mode disables caching, so if that's important for your application this is not a great option. – ericsco – 2013-10-24T19:43:57.220

29

try this line

chrome.exe --kiosk --disable-session-crashed-bubble "http://example.com"

For more detailed information

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

AhbapAldirmaz

Posted 2012-08-13T12:34:33.990

Reputation: 399

8this works well if you include --disable-infobars which then kills the warning alltogether – l0ft13 – 2015-05-28T08:35:08.433

As of now chrome.exe --disable-session-crashed-bubble is just enough to put the prompt away. – Deilan – 2017-04-25T12:09:26.267

14note that this does'nt work with Chrome 58 anymore – bk138 – 2017-05-27T19:36:41.937

1

Yes, --disable-session-crashed-bubble seems to be non-operational, feel free to add your two bits to https://bugs.chromium.org/p/chromium/issues/detail?id=445256#c17 to let the Chromium team know this matters.

– Ben Roberts – 2018-05-07T12:31:55.990

With Chrome 71: --restore-last-session argument when launching chrome – Matt – 2019-01-07T18:38:54.650

28

I see some inconveniences in the solutions provided:

--incognito switch removes cache, what is pretty bad in most circumstances.

(Copy-pasting chrome help )

Google Chrome has hundreds of undocumented command-line flags that are added and removed at the whim of the developers.

--disable-session-crashed-bubble depends of which version of chrome are you using, the most actual version v39 doesn't have this setting allowed.

The solution I did was to alter the user profile and overwrite the crash status to a normal close status, It's a simple hack that works perfect.

This is the script I run in kiosk-mode in a chrome-only session under Ubuntu 12.04 and 14.04

#!/bin/sh
sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/google-chrome/Default/Preferences
sed -i 's/"exit_type": "Crashed"/"exit_type": "None"/' ~/.config/google-chrome/Default/Preferences
google-chrome --kiosk "http://some_url"

It simply finds and replace the string

  • "exited_cleanly":false
  • exit_type": "Crashed"

with

  • "exited_cleanly": true
  • "exit_type": "None"

So, no matter how chrome has closed. It will always think it has closed gracefully. (Tested in many chrome versions)

MiQUEL

Posted 2012-08-13T12:34:33.990

Reputation: 381

If I had used linux back then, I would've probably given this a try. – riha – 2015-02-17T09:59:41.747

1This slightly modified command works with Chromium 56: sed -i -e 's/("exit_type":\s)"Crashed"/\1"None"/g'
-e 's/("exited_cleanly":\s
)false/\1true/g'
~/.config/chromium/Default/Preferences
– Sundae – 2017-01-27T13:15:29.600

Don't forget about the chromium/Local State file, which has the same field. – user3549596 – 2017-04-11T07:40:33.380

1

I put an updated answer, based on this information, at https://superuser.com/a/1206120/4160.

– Josh Kelley – 2017-05-04T20:27:49.377

My version of Chrome (60.0.3112.101) uses a minimized json blob with no spaces between key and value ala "exit_type":"Crashed", so the sed command should handle either – tyleha – 2018-01-23T22:20:07.710

1To make it handle either do something like this: sed -i 's/"exit_type": *"Crashed"/"exit_type": "None"/' ~/.config/google-chrome/Default/Preferences That will handle any number of spaces between the key and values (including none). – rofer – 2018-06-17T16:32:10.440

14

Try this

  • go to chrome://flags/
  • then click Enable on the link that writes: "Disable Better session restore"

I hope this helps

Eran Medan

Posted 2012-08-13T12:34:33.990

Reputation: 281

11Looks like they removed this flag... (Windows Chrome v38), bummer. – Ben Roberts – 2014-10-28T18:22:21.503

4

Open chrome \ Default \ Preference, and change the value to

"exit_type": "none",

"exited_cleanly": true,

Save the file, and put him to attribute "read only". Tested on various versions of the Chrome browser

AquAss

Posted 2012-08-13T12:34:33.990

Reputation: 41

3On Chrome 72 "exit_type": "Normal" appears to be the preferred value. – Zach Bloomquist – 2019-02-28T19:42:42.650

3

Someone has suggested just running Chrome in Incognito mode to get around the problem here. If you are running in full screen mode and redirecting to a specific page that shouldn't be noticeable. I know that's a bit of a work around.

Dom

Posted 2012-08-13T12:34:33.990

Reputation: 31

That certainly provides some helpful info, thanks. My current workaround is to delete the whole profile folder before starting chrome. Incognito is probably the better choice. I'll report back. – riha – 2012-08-15T05:39:19.720

1note, incognito mode disables caching, so if that's important for your application this is not a great option. – ericsco – 2013-10-24T19:44:35.567