HTML:如何建立一个[储存为"按钮? [英] HTML: how to create a "save as" button?

查看:123
本文介绍了HTML:如何建立一个[储存为"按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在您的浏览器,当你想保存您正在查看的HTML页面,你通常转到文件菜单,然后单击另存为。

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.

我可以在有一个HTML页面,做同样的事情底部的小按钮?因此,而不是去文件菜单 - >另存为,我希望我的用户能够点击按钮,保存到磁盘上的页面

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.

有使用Javascript据我知道有一个解决方案,但它仅适用于IE浏览器。在这里看到:链接文本

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

推荐答案

您可以有链接运行加载HTML文件,并用内容处置写回给客户端的服务器端脚本: 附件;文件名= xxx.html 头。

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.

这篇关于HTML:如何建立一个[储存为"按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆