title: How to export HTML file inside iFrame
body: <p>I just want to export a webpage loaded inside an iFrame. But I want to have action from an outer iFrame.</p>
  
  <p>Here's my code to clarify things:</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          some contents here....
          &lt;div id="main"&gt;
              &lt;iframe id="myiframe" src="template/index.html"&gt;&lt;/iframe&gt;
          &lt;/div&gt;
          &lt;a href="#" id="downloadLink"&gt;Export&lt;/a&gt;
          &lt;script src="http://code.jquery.com/jquery-1.11.3.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              $(document).ready(function(e) {
                  function downloadInnerHtml(filename, elId, mimeType) {
                      var elHtml = document.getElementById(elId).innerHTML;
                      var link = document.createElement('a');
                      mimeType = mimeType || 'text/plain';
  
                      link.setAttribute('download', filename);
                      link.setAttribute('href', 'data:' + mimeType + ';charset=utf-8,' + encodeURIComponent(elHtml));
                      link.click(); 
                  }
                  var fileName =  'newlstter.html';
                  $('#downloadLink').click(function(){
                      downloadInnerHtml(fileName, 'main','text/html');
                  });
              });
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I click the <code>export</code> button the HTML file is exported and it will include the iFrame. But if I use these codes inside the inner HTML file it will export.
  But I need to export that current HTML page from the outter site. Exactly like my code above. But I just want to export only the inner HTML.</p>
  
  <p>Can any one give me some suggestion for this?
  Note: Please I need jQuery or JS code, not PHP.</p>
  
  <p>Thanks!</p>