Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

(Note: This is just out of curiosity, hope this doesn't sound stupid or anything.) As I'm sure most of you know, every time Google Chrome is "shut down incorrectly" (eg. cutting the computer's power supply), it will display a yellow bar at the top the very next time it is opened, saying that it wasn't shut down correctly and offering to restore the pages that were last opened. How does it do that? More specifically, how does it detect that it wasn't shut down correctly? Thanks.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It depends on the operating system but one common way for any app to do this is to write to a "logbook" of some sorts every time the app is opened or closed.

In windows this would be the system registry. When chrome opens/closes it writes to the registry that it has successfully opened/closed without any problems. Every time chrome opens it also checks whether there's any discrepancies in the log. If there is a "successfully opened" entry but no matching "successfully closed" entry, then that's when it knows.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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