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

喜你入骨 提交于 2019-11-30 07:10:49

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.

Sarfraz

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.

code guy

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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!