title: How to append current page contents to another page?
body: <p>I have two HTML pages, one is source page and the other one is copy, I need to pass some div elements into other(copy) page body. I did half way, here I used setTimeOut function to achieve it
  How it can done without the timeout function?
  and browser should display the url.</p>
  <p>source page:</p>
  <pre><code>&lt;html&gt;
      &lt;head&gt;        
          &lt;script src=&quot;http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.3.min.js&quot;&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          
          &lt;script&gt;
              function copyCon(){
                  
              var p = document.getElementById(&quot;1&quot;);
              var p_prime = p.cloneNode(true);
              var w    = window.open('printcopy.html');
              
              setTimeout(function(){ 
                  w.document.body.appendChild(p_prime);
              }, 1000);
              }
              
          &lt;/script&gt;
          
          &lt;button onclick=&quot;copyCon()&quot;&gt;copy &lt;/button&gt;
          &lt;div id = &quot;1&quot; style=&quot;width: 500px; height: 500px; border: 1px solid black; position: relative&quot;&gt;
              
              &lt;h3&gt; this is a test heading &lt;/h3&gt;
              &lt;p style=&quot;top: 60px; left: 20px; position: absolute;&quot;&gt; test Paragraph&lt;/p&gt;
              
              &lt;input type=&quot;text&quot; style=&quot;position: absolute; top: 40px; left: 20px&quot;/&gt;
              
          &lt;/div&gt;
          
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>copy:</p>
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      &lt;/head&gt;
      &lt;body&gt;        
      &lt;/body&gt; &lt;/html&gt;
  </code></pre>
  <p>and is there any way to access the elements and execute function of copy page?</p>