javascript - Can I use save button directly in window function -


i have following code.in when click on 'print map' button popup window gets open on there 2 buttons 'save' , 'print'. when click on 'save' button opens window save file.

what want when click on 'print map' button window after clicking save button should open.

function printelem(elem)  {      popup($(elem).html());  }  function popup(data)   {      var mywindow = window.open('', 'parent', 'height=400,width=600');      mywindow.document.write('<html><head><title>my div</title>');      /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');      mywindow.document.write('</head><body >');      mywindow.document.write(data);      mywindow.document.write('</body></html>');      mywindow.document.close(); // necessary ie >= 10      mywindow.focus(); // necessary ie >= 10      mywindow.print();      mywindow.close();      return true;  }
<script src="http://cdnjs.cloudflare.com/ajax/libs/jspdf/0.9.0rc1/jspdf.min.js"></script>  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  <script src="http://html2canvas.hertzen.com/build/html2canvas.js"></script>  <body>      <section>          <div class="main_div">              <div>                  <div class="nav_div">                      <input type="button" value="print map"  onclick="printelem('.parent')" />                  </div>                        </div>                <div class="parent">                          <h1>hello all</h1>                </div>          </div>      </section>  </body>               

could not add download link html on save button - can't see save button here - if have directory, , same file - can anchor save button this.

<a href="./directory/yourfile.pdf" download="newfilename">save</a> 

this save file suggested name "newfilename" can emit though, , have sever name of pdf used:

<a href="./directory/yourfile.pdf" download>save</a> 

it html5 feature, , not supported in old ie, suggestion.

hope solves looking do, might have misunderstood.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -