Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes how to open pdf file by clicking on jsp link tag using javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to open pdf file by clicking on jsp link tag using javascript" Watch "how to open pdf file by clicking on jsp link tag using javascript" New topic
Author

how to open pdf file by clicking on jsp link tag using javascript

SaiManasa Dasari
Ranch Hand

Joined: Aug 21, 2012
Posts: 32
I have a "a" tag and clicking on that a PDF file should open(Not in a browser.It should open directly)
<a " onclick="openFile('<%=filepath%>')" >filename</a>


This is my javascript code...

function openFile(path)
{
window.open(path);
}
but its not working.
pdf file and jsp are in different locations and filepath is an entire path of file which it exist like /home/Document1_1345617151061/Consolidate.pdf..
please provide me the solution.

Thanks..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to open pdf file by clicking on jsp link tag using javascript
 
Similar Threads
Access denied error
Problem in opening PDF or FDF in Firefox?
Creating File object problem
PDF in JSF
how to download or view the "Excel FILE "i n IE browser