PostMessage Read Iframe content
<p>I have requirement where i need to get content of iframe where src is of another domain below is my code</p>

<pre><code>&lt;iframe id="receiver" src="http://demos.mattwest.io/post-message/receiver.html" width="500" height="200"&gt;
  &lt;p&gt;Your browser does not support iframes.&lt;/p&gt;
&lt;/iframe&gt;



&lt;script&gt;
setTimeout(function(){ 
console.log($('#receiver').contents().find('body'));
 }, 2000); 
</code></pre>

<p>I got following error</p>

<pre><code>jquery-2.2.4.js:3079 Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "null" from accessing a frame with origin "http://demos.mattwest.io".  The frame requesting access has a protocol of "file", the frame being accessed has a protocol of "http". Protocols must match.
</code></pre>

<p>I Searched a lot and found about PostMessage <a href="http://blog.teamtreehouse.com/cross-domain-messaging-with-postmessage" rel="nofollow">http://blog.teamtreehouse.com/cross-domain-messaging-with-postmessage</a></p>

<p>Here they are sending message and my goal is to get iframe content how can i implement postMessage in my sceneario.</p>

<p>I cant able to create fiddle, its showing some other issue <a href="https://jsfiddle.net/alokranjan39/re6aja0c/" rel="nofollow">https://jsfiddle.net/alokranjan39/re6aja0c/</a></p>

<p>How to resolve this please help!!! </p>