How to change the title of a browser page which a servlet streamed a PDF to?

后端 未结 5 743
情歌与酒
情歌与酒 2020-12-09 04:55

My Java based webapp has a servlet which streams PDF content back to the browser based on request parameter.

e.g. user clicks on an A tag with an href of \"myApp/Fet

5条回答
  •  没有蜡笔的小新
    2020-12-09 05:42

    Add this header to your HttpServletResponse:

    response.setHeader("Content-Disposition","inline; filename=Here is the Amazing PDF");
    

    I believe the browser will pick it up and use it as the title of the window.

提交回复
热议问题