jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes Browser Support to open a file by clicking on filename Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Browser Support to open a file by clicking on filename" Watch "Browser Support to open a file by clicking on filename" New topic
Author

Browser Support to open a file by clicking on filename

SaiManasa Dasari
Ranch Hand

Joined: Aug 21, 2012
Posts: 32
Hi
Here is my code to open file by clicking on filename.




Now my problem is when clicking on link to open pdf/text/image files in new window it working fine for firefox.but in IE it showing open/save dialogbox when opening file.
can anyone help me what changes need to do to open file directly in new window by clicking on filename.

Thanks..
SaiManasa Dasari
Ranch Hand

Joined: Aug 21, 2012
Posts: 32
if i give like

its working in IE also.but documentdownload.jsp is opening again in new window.how to prevent opening new jsp again.can anyone please help me.

I tried also.its opening new blank window.without opening new blank window how to get work this?please reply me...
narayana Ega
Greenhorn

Joined: Aug 23, 2012
Posts: 26
If You want to open a file then simply you can execute a command from your java program to open that file.

if you want to get the file abc.pdf opened, You can use the following command...

String command = "abc.pdf";
Process child = Runtime.getRuntime().exec(command);

Before you are using this command set the path of the file....in command line with your java program like

if the file is in "c:/My Files/abc.pdf" then
String command = "cd c:/My Files";
Process child = Runtime.getRuntime().exec(command);

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

narayana Ega wrote:If You want to open a file then simply you can execute a command from your java program to open that file.

Except that this is in a web app and Java isn't useful for doing anything on the client unless it's an Applet.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Browser Support to open a file by clicking on filename