tags:

views:

63

answers:

2

I want to open a PDF file in a new browser window when user clicks on the image. I saw the other links but not found what I am looking for.

Any PHP/HTML way to do this?

+2  A: 
<a href="path-to-my.pdf" target="_blank"><img src="image.gif" alt="my shiny PDF" border="0"/></a>
Traveling Tech Guy
you forgot the alt attribute, which is required by xhtml strict ;)
Peter
Ah, all you strict guys... :) Fine, I'll add it ;)
Traveling Tech Guy
Since there is a target attribute and a border attribute, it can't be Strict. The attribute is mandatory in all versions though. The space before the / that is required by the HTML compatibility guidelines is missing though.
David Dorward
The alt attribute’s pretty important for blind users in this case. There’s nothing else that indicates where the link goes.
Paul D. Waite
+1  A: 
<a href="mypdf.pdf" target="_blank"><img src="image.png" width="320" height="240" alt="My Super Awesome PDF" /></a>
Htbaa
In a non-example, the alt attribute would have a useful value though. A link with nothing to identify the target isn't very helpful.
David Dorward
Changed it. Thought it would be obvious to most. Do we really have to chew someones food?
Htbaa
This **is** a question at the level of "Opening a link in a new window".
David Dorward
Ah good point! Forgot about that :-)
Htbaa