HTML: how to create a “save as” button?

后端 未结 4 2004
醉话见心
醉话见心 2020-12-30 10:25

In your browser, when you want to save an HTML page that you are currently viewing, you normally go to the File menu and click Save As.

Can I have a little button at

相关标签:
4条回答
  • 2020-12-30 11:07

    Take a look at downloadify jQuery plugin, which using flash to save. Javascript alone is impossible.

    0 讨论(0)
  • 2020-12-30 11:20

    You could have the link run a server side script that loads the HTML file and writes it back to the client with a Content-Disposition: attachment; filename=xxx.html header.

    0 讨论(0)
  • 2020-12-30 11:25

    You have to create a button that downloads the HTML file, or the page you're on:

    <form><input type="button" value="Download Now" onClick="window.location.href='yourpage.html'"></form>
    
    0 讨论(0)
  • 2020-12-30 11:27

    The document.execCommand('SavaAs') works only in IE but the following link suggests other possibilities you may want to try out.

    Here is the answer to that :)

    0 讨论(0)
提交回复
热议问题