下载文本文件,而不是在浏览器中打开 [英] download the text file instead of opening in the browser

查看:29
本文介绍了下载文本文件,而不是在浏览器中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本文件:

当我单击下载时,它应该下载并将其保存在我的本地下载路径中.

When i click the Download it should download and save it in my local download path.

我尝试过.

window.open("data.txt");

header("Location:data.txt")

但是两者都打开了它自己的文本文件浏览器.我下载了txt文件.

But both are open the text file browser it self. I what download the txt file.

任何人请帮助我.

谢谢

人体模型.

推荐答案

http标头可以解决您的问题,只是推荐人

http headers may solve your problem, just referr

 http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

这篇关于下载文本文件,而不是在浏览器中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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