Messaging from iframe to extension

1,498 views
Skip to first unread message

Ben McCann

unread,
Sep 8, 2013, 4:30:48 PM9/8/13
to chromium-...@chromium.org
Hi,

I'd like to message between an iframe and extension. I've found that sending a message from the iframe to the extension with chrome.runtime.sendMessage works only if I've listed both the domain of the web page containing the iframe and the domain of the page in the iframe src in the manifest's externally_connectable. Is it expected that I should have to list the domain of the parent page in externally_connectable? I'd like the extension to be able to message with my webpage in an iframe regardless of the site that holds it, but this seems impossible since externally_connectable will not let you wildcard the domain. Any suggestions on how I might accomplish this?

Thanks,
Ben

Jordan McDonald

unread,
Sep 8, 2013, 4:38:21 PM9/8/13
to Ben McCann, chromium-...@chromium.org
Think this example might be what you want to do.





--
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 post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/55a6bda8-c9b1-4291-83cd-752fc988b4a0%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/groups/opt_out.

David Levin

unread,
Sep 8, 2013, 5:53:04 PM9/8/13
to Ben McCann, chromium-...@chromium.org
Disclaimer: I wasn't involved in creating this feature. However, I've been an interested consumer and that doesn't sound like a good behavior at all.

I'd suggest writing a simple repro and posting a bug to http://crbug.com/new

dave



On Sun, Sep 8, 2013 at 1:30 PM, Ben McCann <benjamin...@gmail.com> wrote:

Ben McCann

unread,
Sep 8, 2013, 11:23:15 PM9/8/13
to chromium-...@chromium.org, Ben McCann


On Sunday, September 8, 2013 2:53:04 PM UTC-7, David Levin wrote:
Disclaimer: I wasn't involved in creating this feature. However, I've been an interested consumer and that doesn't sound like a good behavior at all.

I'd suggest writing a simple repro and posting a bug to http://crbug.com/new

dave

On Sun, Sep 8, 2013 at 1:30 PM, Ben McCann <benjamin...@gmail.com> wrote:
Hi,

I'd like to message between an iframe and extension. I've found that sending a message from the iframe to the extension with chrome.runtime.sendMessage works only if I've listed both the domain of the web page containing the iframe and the domain of the page in the iframe src in the manifest's externally_connectable. Is it expected that I should have to list the domain of the parent page in externally_connectable? I'd like the extension to be able to message with my webpage in an iframe regardless of the site that holds it, but this seems impossible since externally_connectable will not let you wildcard the domain. Any suggestions on how I might accomplish this?

Thanks,
Ben

--
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-extensions+unsub...@chromium.org.
Reply all
Reply to author
Forward
0 new messages