Hi,
I'm trying to open different types of Attachments. All The attachments are opening with their respective applications In new window.
E.g .doc in MSWord.
Whereas coming to JPEG, gif files. These are opening in the same window . I need to open them in new window.
I'm writing this code for opening an attachment :
response.setHeader("Content-Disposition","attachment;fileName=".concat(String.valueOf(destFileName)));
BufferedInputStream bis = new BufferedInputStream(blobStream);
response.setContentLength((int)blob.length());
int aByte = 0;
while ((aByte = bis.read()) != -1) {
response.getOutputStream().write(aByte);
}
bis.close();
response.flushBuffer();
I want to do this at Client Side.
Please help me.
-
Downloading a jpeg image in new window (5 messages)
- Posted by: Raja Ravi Kumar
- Posted on: October 04 2004 10:55 EDT
Threaded Messages (5)
- Downloading a jpeg image in new window by Kailash Vasani on October 05 2004 02:20 EDT
- Downloading a jpeg image in new window by Joe Attardi on October 05 2004 16:20 EDT
- Downloading a jpeg image in new window by Joe Attardi on October 05 2004 16:22 EDT
-
Javascript? by Sven Helmberger on October 05 2004 05:12 EDT
- stupid by Sven Helmberger on October 05 2004 05:15 EDT
-
Javascript? by Sven Helmberger on October 05 2004 05:12 EDT
- Downloading a jpeg image in new window by Joe Attardi on October 05 2004 16:22 EDT
-
Downloading a jpeg image in new window[ Go to top ]
- Posted by: Kailash Vasani
- Posted on: October 05 2004 02:20 EDT
- in response to Raja Ravi Kumar
Open new window whenever user clicks on URL of JPG file using javascript. -
Downloading a jpeg image in new window[ Go to top ]
- Posted by: Joe Attardi
- Posted on: October 05 2004 16:20 EDT
- in response to Raja Ravi Kumar
Use the window.open() JavaScript method.
Basically, something like this:
function openImage(image)
{
window.open(image, "imageWindow", "width=400,height=400");
}
and in your JSP page, you could do:
<a href="#" onclick="openImage(<%= destFileName %>)">View File</a> -
Downloading a jpeg image in new window[ Go to top ]
- Posted by: Joe Attardi
- Posted on: October 05 2004 16:22 EDT
- in response to Joe Attardi
Oops! I forgot the quotes. The link should look like:
<a href="#" onclick="openImage('<%= destFileName %>')">View File</a> -
Javascript?[ Go to top ]
- Posted by: Sven Helmberger
- Posted on: October 05 2004 17:12 EDT
- in response to Joe Attardi
one should avoid using javascript where it is not nessecary.
<a href="image.jpg" target="_blank">View JPG</a> -
stupid[ Go to top ]
- Posted by: Sven Helmberger
- Posted on: October 05 2004 17:15 EDT
- in response to Sven Helmberger
this forum has a strange behaviour - replacing " with " :
<a href="image.jpg"> View JPG </a>
allows you to show the image in a new window even when the client's javascript is disabled.