Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I bypass the download dialogue box while downloading a file.

 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I want to show an excel file in the browser. How can I bypass the download dialogue box and show it directly in the browser.
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set response content type to application/vnd.ms-excel , Don't add content-disposition header, and just write down the file to response steam. It will open up in browser instead of asking user to save.
 
Pete Nelson
Ranch Hand
Posts: 147
Debian Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudir Nim gives the best option, but keep in mind, the "save" dialog box is a function of the browser, and not the server. How the browser behaves when any file is accessed is based on the configuration of the browser.

With Sudir Nim's suggestion, the server gives a "hint" to the browser (it's not telling it to save via content-disposition), but it's still up to the browser to determine what to do.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic