Suppose you want to call a function on an cross domain iframe with id monu. Let the function be subins(). Here’s how to do it using postMessage technic.
The alert in the code above is not a function. The parameter targetOrigin is set to * because we don’t know the url of the iframe. Now the code in the iframe :
When a postmessage callback is received on the iframe the origin where the postMessage callback is called is checked on the script in iframe and if it is true, subins() is called and it will alert the text Support Wikipedia.
So now you know how to communicate between cross domains. Code Great.