MV3: Getting access to javascript object in Background script from Popup script?

237 views
Skip to first unread message

Morten Overgaard

unread,
Apr 29, 2022, 2:43:05 PM4/29/22
to Chromium Extensions
Hi,

We have an extension in where the background script is creating an object (with operations) that we somehow wants to get a reference to from the popup script.

Is this supported ?

BR Morten

Jackie Han

unread,
Apr 30, 2022, 5:50:47 AM4/30/22
to Morten Overgaard, Chromium Extensions
Is this supported ?
No, it is not supported.

In MV3, the background script is a service worker that is not always active. You should exchange messages through extension api or standard web api. Or you can save data to storage in background and read data in popup.

PS: chrome.extension.getBackgroundPage() and chrome.extension.getViews() can't get the service worker in MV3.

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/ea2c79f5-99c8-4523-b71c-10ff8ad68828n%40chromium.org.

Morten Overgaard

unread,
Apr 30, 2022, 5:08:07 PM4/30/22
to Chromium Extensions, Jackie Han, Chromium Extensions, Morten Overgaard
Thx - appreciated
Reply all
Reply to author
Forward
0 new messages