How can a Google Chrome extension get out of 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 this is to create a wallpaper, and check localStorage.setup on this page. If it is not there, set it to true and open the options page. This approach works, but besides being confusing, it is inefficient. Not only does the background page load every time the user opens the browser, but he will constantly work in the background.

Is it possible to specify chrome so that the background page is finished and should be closed? Or is there any way for an extra background page to prevent loading in the future? Or is there a better way to solve my problem?

+1
source share
1 answer

With transitional background pages, the background page will automatically exit as soon as all of the code it runs has finished. This feature will be in a future release of Chrome, but since it is still under active development, there is no documentation for it yet.

+3
source

Source: https://habr.com/ru/post/923063/


All Articles