Home  >  Article  >  Web Front-end  >  javascript save file to local implementation method_javascript skills

javascript save file to local implementation method_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:47:391419browse

Both forms are available
The first one:

Copy code The code is as follows:

<script> <br>function SaveAs5(imgURL) <br>{ <br>var oPop = window.open(imgURL,"","width=1, height=1, top=5000, left=5000 "); <br>for(; oPop.document.readyState != "complete"; ) <br>{ <br>if (oPop.document.readyState == "complete")break; <br>} <br> oPop.document.execCommand("SaveAs"); <br>oPop.close(); <br>} <br></script>


Second type:
Copy code The code is as follows:

<script> <br>function SaveAs5(imgURL) <br>{ <br>var oPop = window.open(imgURL,""," width=1, height=1, top=5000, left=5000"); <br>for(; oPop.document.readyState != "complete"; ) <br>{ <br>if (oPop.document.readyState == "complete")break; <br>} <br>oPop.document.execCommand("SaveAs"); <br>oPop.close(); <br>} <br></script>

Click here to download the image
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn