HTML: how to create a "save as" button?

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 the bottom of an HTML page that does the same thing? So instead of going to the File menu -> Save As, I want my user to be able to click the button to save the page on to the disk.

There is a solution exists using Javascript as far as I know, but it only works for IE. See here: link text


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 Content-Disposition: attachment; filename=xxx.html header.


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 :)


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

链接地址: http://www.djcxy.com/p/36596.html

上一篇: 我怎样才能在同一页面上放置多个充当链接的html按钮?

下一篇: HTML:如何创建“另存为”按钮?