st-boost
st-boost

Reputation: 1907

How can a Google Chrome extension exit its own background process?

My goal is very simple: when the user installs the extension, open the options page.

The only way I know how to do that is to create a background page, and on that page check for localStorage.setup. If it is not present, set it to true and open the options page. This approach works, but, besides being convoluted, it's inefficient. Not only will the background page load every time the user opens the browser, but it will constantly be running in the background.

Is there any way to tell chrome the background page is finished, and should be exited? Or is there any way for an extension's background page to prevent itself from being loaded in the future? Or, is there a better way to solve my problem?

Upvotes: 1

Views: 987

Answers (1)

Mihai Parparita
Mihai Parparita

Reputation: 4236

With transient background pages, the background page will exit automatically once all code that it's running finishes. This feature will be in a future Chrome release, but since it's still under active development, there isn't documentation for it yet.

Upvotes: 3

Related Questions