当前位置:网站首页>JS cannot get content disposition in headers
JS cannot get content disposition in headers
2022-07-25 07:13:00 【Xiao Li loves programming】
Export download function
Problem recurrence
The front end realizes the export and download function
Here is the realization of Export function But when online There is The problem of export failure ;
We need to get the response header Content-Disposition Value of field , Separate the file name .

You can see here It's printed content-disposition

Online network You can also see that This filename ; But when I print it out from the request header , There is no such field ; So online export will fail 
To analyze problems
Browsers limit the exposure of this kind of request headers ; Therefore, it needs the cooperation of the server ;

Solution
Although this is added to the back end ; But we can only network see , Unable to get js Get it in the request header Content-Disposition
So you need to add a piece of code
response.setHeader("Access-Control-Expose-Headers","Content-Disposition");
effect
With this piece of code, you can export successfully ;
The back-end code is attached here

边栏推荐
- Precautions for starting up the server of Dahua Westward Journey
- [semidrive source code analysis] [drive bringup] 39 - touch panel touch screen debugging
- Talk about practice, do solid work, and become practical: tour the digitalized land of China
- [daily question] sword finger offer II 115. reconstruction sequence
- New tea, start "fighting in groups"
- Rambus announces ddr5 memory interface chip portfolio for data centers and PCs
- CEPH in hand, I have!
- Can interface debugging still play like this?
- Expandablelistview nested GridView display incomplete problem
- Meta is in a deep quagmire: advertisers reduce spending and withdraw from the platform
猜你喜欢

What are the hazards of insufficient sleep?

Cointegraph wrote: relying on the largest Dao usdd to become the most reliable stable currency

Scavenging vultures or woodpeckers? How to correctly understand short selling

What if Oracle 19C migration encounters large lob tables?
![[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (V)](/img/cf/44b3983dd5d5f7b92d90d918215908.png)
[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (V)

阿里云镜像地址&网易云镜像

CTF Crypto---RSA KCS1_ Oaep mode

LeetCode118. 杨辉三角

Luo min's backwater battle in qudian

从ACL 2022 Onsite经历看NLP热点
随机推荐
Box horse "waist cut", blame Hou Yi for talking too much?
Security compliance, non-stop discounts! High quality travel service, "enjoy the road" for you
10 minutes to understand how JMeter plays with redis database
Octopus network community call 1 starts Octopus Dao construction
批量导入数据,一直提示 “失败原因:SQL解析失败:解析文件失败::null”怎么回事?
knapsack problem
北京内推 | 微软STCA招聘NLP/IR/DL方向研究型实习生(可远程)
Learn when playing No 7 | don't study this holiday, study only
2022天工杯CTF---crypto1 wp
Leetcode skimming: dynamic programming 06 (integer splitting)
论文阅读:UNET 3+: A FULL-SCALE CONNECTED UNET FOR MEDICAL IMAGE SEGMENTATION
Rongyun launched a real-time community solution and launched "advanced players" for vertical interest social networking
The idea of the regular crawler of the scratch
Decrypting numpy is a key difficulty in solving the gradient
微信小程序wx.request接口
微生物健康,不要排斥人体内微生物
Wei Lai: what is the difference between multithreaded join and detach?
一日千里,追风逐月 | 深势科技发布极致加速版分子对接引擎Uni-Docking
Kubernates-1.24.2 (latest version) + containerd + nexus
【云原生】原来2020.0.X版本开始的OpenFeign底层不再使用Ribbon了