【问题标题】:Content-Disposition inline filename issue with internet explorerInternet Explorer 的 Content-Disposition 内联文件名问题
【发布时间】:2018-07-23 10:50:15
【问题描述】:

HTTPResponse 对象:

最终的 httpResponse

HTTP/1.1 200 
Vary: Accept-Encoding
Content-Type: application/pdf
Content-Dis;filename*=utf-8''aproved.pdf
Expires: 0
Cache-Control: must-revalidate, post-check=0, pre-check=0
Pragma: public
Content-Encoding: gzip

内容处置在我们传递时采用文件名(approved.pdf)

但是当我们在 IE 中保存查看器中的 pdf 时,它会保存为 Downlaod.pdf(其中 Download 是 servlet 名称)

通过使用 Content-Dispostion 保存实际的 filename.pdf,相同的用例在其他浏览器 (chrome) 中也能正常工作

IE 浏览器需要这方面的帮助。

【问题讨论】:

    标签: java internet-explorer httpresponse


    【解决方案1】:

    不应该是:

    Content-Type: application/pdf
    Content-Disposition: inline; filename="aproved.pdf"
    

    ?

    【讨论】:

    • 根据 RFC 6266/RFC 5987 标准编码,所有现代浏览器的首选编码:"filename*=utf-8''" + filename
    猜你喜欢
    • 1970-01-01
    • 2011-05-14
    • 2011-06-29
    • 2016-12-18
    • 2011-05-09
    • 1970-01-01
    • 1970-01-01
    • 2010-12-02
    • 1970-01-01
    相关资源
    最近更新 更多