I have a webpage that displays image in an <img>
tag. My client now wants to have a Save As dialog when someone clicks on the Save As button, so that the user can avoid right-clicking. I need it to work on the Safari browser. How can I do that?
Asked
Active
Viewed 723 times
0

bfavaretto
- 71,580
- 16
- 111
- 150

user16
- 105
- 2
- 8
2 Answers
1
You are looking for the Content-Disposition HTTP header (which can be found here).
Specifically you need:
Content-Disposition: attachment; filename="fname.ext"

Lucas Green
- 3,951
- 22
- 27
1
You should implement changes on your server.
Using the header: Content-Disposition
.
Content-Disposition: attachment; filename=MyFileName.png
In ASP.NET
Response.AddHeader("Content-Disposition", "attachment; filename=MyFileName.png");

jorgebg
- 6,560
- 1
- 22
- 31
-
thanks for your reply.But that is where i am facing a problem.i dont have physical location of the image.i have src of the image as byte array like this '0x49492A009E4F000093503684F9DA3BCB7175FFFFFFFF32EC8F97C8E6623065E3111CC8ECCD9B8C65F2ECB991F2F91CBFFF048117E0813F82845D2045F410229FA0409C178617FEFD5BFB5FB4852BBF1EFFFF5C1FFC20BC1FFF5B7075FFFD60BE2B8820582FFF561C17FFFFFE0817FFFFF0DFAFFFDF7AEFFFA6C1027ADC8FFEFFFFF6B636B8386C535EC541FFFC44444444444444444447FFFFF9D89B3......' – user16 Aug 29 '12 at 09:04
-
and when i am trying to use this- context.Response.Headers["Content-Type"] = "image/tiff"; i am getting this error "This operation requires IIS integrated pipeline mode" – user16 Aug 29 '12 at 09:10
-
Use context.Response.Headers.AddHeader method instead. See this answer to output the bytes: http://stackoverflow.com/a/3625607/208683 – jorgebg Aug 29 '12 at 10:52
-
can not use that. If i try to use i ll get this error -System.Collections.Specialized.nameValueCollection does Not contain a definition for AddHeader – user16 Aug 29 '12 at 10:57