Re: [crx] hello,how to send messages from background to popup in chrome extesion?

1,771 views
Skip to first unread message

PhistucK

unread,
Oct 10, 2012, 10:21:31 AM10/10/12
to tingli ye, chromium-...@chromium.org
Generally, you do not have to use message passing.
I am not sure whether this is a best practice, though, but you can use chrome.extension.getViews({"type": "popup"}), which returns a window and do whatever you want with it. In reverse, use chrome.extension.getBackgroundPage().
If you still want to use message passing, either chrome.extension.sendMessage or chrome.extension.connect sound like viable solutions. All of the active extension pages (popups, tabs, whatever) will get the message passed by sendMessage, like the documentation states.

PhistucK



On Wed, Oct 10, 2012 at 4:05 PM, tingli ye <ytl...@gmail.com> wrote:

Hi All, 
        Have a small doubt in how message passing to popup from background. :(

--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/cyF2-D9LOsMJ.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.

Reply all
Reply to author
Forward
0 new messages