Gupta.Swap
Gupta.Swap

Reputation: 265

Creating window.postMessage() in GWT for cross-domain iframe messaging

I am trying to communicate between parent window and IFrame(IFrame source being on different domain), which is not allowed directly since the Same Origin Policy. The communication is easy via window.postMessage() method of HTML5. So i searched for existing works in this field and i found gwt-rpc-plus library

It includes a class PostMessageFrameTransportRequest. Now, I think that this would work. But I am not getting on how to use this class.
I need some help with this code and if anyone knows about some other method to give same behavior as window.postMessage() please help me out.
Thanks in advance....

Upvotes: 1

Views: 2337

Answers (1)

Daniel Kurka
Daniel Kurka

Reputation: 7985

You can just use JSNI to call javascript directly

something like:

private native void sendMessage(String message)/*-{
    $wnd.postMessage(...., message);
}-*/;

Upvotes: 1

Related Questions