简体   繁体   中英

How to not display open button from open file dialogue while downloading file using internet explorer

I have java code through which i set content type of excel and send it to browser. when ever it is downloaded using IE it shows open file dialogue which has OPEN,SAVE,CANCEL button. I need to avoid this OPEN button and only show SAVE & CANCEL button, how to do this java. I googled and found info that if we set meta type of contect in IE for download-option as noOPEN then this might be achieved; But i am not getting how to do this using java.

You can either render it inline by setting proper header

"content-disposition", "inline;filename=somefile.someExt"

or you can make it like attachment

"content-disposition", "attachment;filename=somefile.someExt"

in which case browser has its own way to prompt user, you can't change it [unless your browser provides some sort of setting that your client can set]

in java you can use

response.setHeader("X-Download-Options", "noopen");

this code for hide open button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM