Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open File in New Browse Window

 
Steve Dyke
Ranch Hand
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the following code to open a pdf file. A button is located on my JSP to fire the code. The problem is the pdf file opens in the calling browser window. the users want to see it open in a separate browser window.

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look up the Content-Disposition response header
It can be used to suggest a file name for your response and also suggest whether the browser should display the resource as an attachment or inline.

(There is an example of it in the JSP FAQ under JspAndExcel)
[ August 20, 2007: Message edited by: Ben Souther ]
 
Steve Dyke
Ranch Hand
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that fixed that part. Now what about a hypperlink? Can this be called up in a separate window?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use "attachment" instead of "inline" in your Content-Disposition header, the browser will either open the application in a new window (if there is an associated application for this mime type) or prompt the user to either "Save As" or "Open With".
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic