Is it possible to force the popup to open? Or to have a notification symbol?

581 views
Skip to first unread message

Phil Oxnard

unread,
Apr 8, 2021, 8:05:19 AM4/8/21
to Chromium Extensions
I want my popup to open up when it detects a specific state change from the server. My service worker can detect the state change, but I don't know if its possible to relay info from either the server or the service worker to the popup if the popup isn't already open.

Roberto Oneto

unread,
Apr 8, 2021, 8:49:57 AM4/8/21
to Chromium Extensions, phil....@gmail.com
From  https://developer.chrome.com/docs/extensions/reference/action/#method-setPopup
An action's popup will be shown when the user clicks on the extension's action button in the toolbar. The popup can contain any HTML contents you like, and will be automatically sized to fit its contents. The popup cannot be smaller than 25x25 and cannot be larger than 800x600. The popup is initially set from the default_popup property in the action key in the manifest.json file. If present, this should point to a relative path within the extension directory. It can also be updated dynamically to point to a different relative path using the action.setPopup() method.

It would therefore seem that the answer to your question is no.

However, you can change the appearance of the browserAction icon and its tooltip.

You can change the icon or place a badge on it.

This way the user will see the change and will be motivated to activate the popup manually.

If you don't want to change the appearance of the icon, you can always create a notification when needed.


Jackie Han

unread,
Apr 8, 2021, 12:57:39 PM4/8/21
to Roberto Oneto, Chromium Extensions, phil....@gmail.com
Roberto’s answer is the most reasonable solution available at the moment.

--
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/eb081bcb-9308-44d4-a0c3-5e4539bddc03n%40chromium.org.

Tyler Durden

unread,
Aug 3, 2021, 9:04:06 AM8/3/21
to Chromium Extensions, Jackie Han, Chromium Extensions, phil....@gmail.com, Robbi

I faced the same problem. Did you find the right code ?
четверг, 8 апреля 2021 г. в 19:57:39 UTC+3, Jackie Han:

wOxxOm

unread,
Aug 3, 2021, 10:14:37 AM8/3/21
to Chromium Extensions, khol...@gmail.com, Jackie Han, Chromium Extensions, phil....@gmail.com, Robbi
You can add your UI to the web page using a content script.

Tyler Durden

unread,
Aug 3, 2021, 2:45:35 PM8/3/21
to Chromium Extensions, wOxxOm, Tyler Durden, Jackie Han, Chromium Extensions, phil....@gmail.com, Robbi
Yes, of course I can. But I want to pop up on this page or repaint the icon in a different color, but I can't do it.
I'm sorry if this question is very stupid

вторник, 3 августа 2021 г. в 17:14:37 UTC+3, wOxxOm:

wOxxOm

unread,
Aug 4, 2021, 2:57:30 PM8/4/21
to Chromium Extensions, khol...@gmail.com, wOxxOm, Jackie Han, Chromium Extensions, phil....@gmail.com, Robbi
Yes, you can do it easily: show your UI inside the page (in an iframe for more isolation) so it'll look exactly like an open popup. Additionally change the icon via chrome.browserAction.setIcon. Many extensions do it like this. The only other solution is to open a separate window with the UI inside, but it's worse.

Simeon Vincent

unread,
Aug 4, 2021, 4:15:52 PM8/4/21
to Chromium Extensions, wOxxOm, khol...@gmail.com, Jackie Han, Chromium Extensions, phil....@gmail.com, Robbi
For an example of an extension that changes the icon at runtime, see https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api/action

Simeon - @dotproto
Chrome Extensions DevRel

Reply all
Reply to author
Forward
0 new messages