res.setHeader('Content-Type', 'application/octet-stream');
// 在响应之前,告诉浏览器,这个数据是要作为文件下载的
// 通过设置响应报文头实现
res.setHeader('Content-Disposition', 'attachment; filename=demo.txt');
res.setHeader('Content-Type', 'application/octet-stream');
// 在响应之前,告诉浏览器,这个数据是要作为文件下载的
// 通过设置响应报文头实现
res.setHeader('Content-Disposition', 'attachment; filename=demo.txt');
本文标题:通过设置响应头使浏览器弹窗下载
本文链接:https://www.haomeiwen.com/subject/shzqsxtx.html
网友评论