deostroll
deostroll

Reputation: 11975

chrome extension: which page getBackgroundPage() retrieve?

I am a little confused whether this api suits my need. I want a common place to view my logs, instead of going around to the popup's console, the background page's console, etc...

Then I noticed that you can include several background scripts. In which case, which page does the api give us?

Upvotes: 1

Views: 55

Answers (1)

Aefits
Aefits

Reputation: 3469

Chrome does not support multiple background pages in a chrome extension. It supports multiple background scripts. But it does not supports both background page and background scripts at the same time. See below the screenshots.

Error shown when we try add background page and script at the same time.

enter image description here

Error shown when we try add multiple background pages.

enter image description here

Now coming back to your question which page getBackgroundPage() retrieve?

Since chrome supports only one background page it will return the only page that you include in you manifest.json.

Upvotes: 1

Related Questions