title: JQuery cross origin iframe innerHtml
body: <p>I want to read iframe contents that have loaded third-party URL.</p>
  <p>I can postMessage simple string from iframe to form. But want to pass innerHtml or want to access it from an unload callback. It always gives cross-origin. Please let me know how to access the HTML of the remote site and send it to the form?</p>
  <p>HTML code as below:</p>
   // here somehow want to send html of iframe......
  <pre><code>&lt;p&gt;&lt;a href=&quot;http://thirdparty_url.com/&quot; target=&quot;myFrame&quot;&gt;ICWT Page&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  <p>scripts and postmessage code:</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
  
      function on_load(iframe,mystring, mywindow) {
          var win = (iframe.contentWindow || iframe.contentDocument);
  
          // or here want to access HTML of iframe and post to form.
  
          alert(mystring);
  
          mywindow.postMessage(mystring, &quot;*&quot;);
      };
  
      function listener(event) {
          alert(event.data);
      }
  
      if (window.addEventListener) {
          window.addEventListener(&quot;message&quot;, listener, false);
      }
      else {
          attachEvent(&quot;onmessage&quot;, listener);
      }
  &lt;/script&gt;
  </code></pre>
  <p>Or send innerHtml from iframe to on_load();</p>
  <pre><code>&lt; iframe src=&quot;index.cfm&quot; name=&quot;myFrame&quot; onload=&quot;on_load ( this, document.body.innerHtml, window ) &quot;&gt;&lt; /iframe &gt; 
  </code></pre>
  <p>Here document.body.innerHtml -&gt; I am trying to assume it has contents of iFrame which has loaded third party url.</p>