[whatwg] using postMessage() to send to a newly-created window

Jonas Sicking jonas at sicking.cc
Tue Jan 5 17:03:44 PST 2010


On Tue, Jan 5, 2010 at 5:00 PM, Darin Fisher <darin at chromium.org> wrote:
> The window doesn't open synchronously, so you should have to wait for
> http://x/ to load (or for its document to at least be created) before you
> can start communicating with it.
> Note: If you instead open "about:blank" you should be able to communicate
> with it synchronously since "about:blank" is loaded synchronously.  It is
> special-cased.
> From the newly opened window, you could try posting a message to its opener.
>  The opener could then handle that event and use it as a signal to know that
> it can know begin communicating with the newly opened window.
> I haven't tested any of this ;-)

This is a sort of suboptimal state of affairs though. Compare to
workers, which also do not load synchronously, but which you can
immediately send messages to using postMessage().

We could use a similar solution for windows postMessage as we use for
worker postMessage.

The main question is if that would break existing content.

/ Jonas



More information about the whatwg mailing list