[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

how to link a PDF file from webpage correctly

I use the code below to link a PDF file from my webpage. But sometimes when I click the hyperlink, a blank web page is displayed. And I need to click the ReFresh button, then the web page display the PDF.  

<A href="myfiles/abc.pdf" target=_blank>ABC2005</a>


Where is wrong? Please tell me a right way to display PDF file. Many thanks!!
0
steven98
Asked:
steven98
  • 5
  • 4
  • 3
  • +5
1 Solution
 
cjinsocal581Commented:
How big is the PDF file?

What version of Acrobat are you running?

Because it works here:

http://geecom.net/articles/pdfdoc.asp

Let me know if you have the same issue with the above link.
0
 
dougdayCommented:
You know, that stinks of spyware on your computer.  Have you run a virus scan lately?  Is this problem only happening on *your* computer?

-Doug
0
 
steven98Author Commented:
my PDF file is only 543k.    Acrobat Reader 6.0    It works when I click your link.

About my code:

The problem is sometimes it works(displayed properly), sometimes is does not(blank page)!

really strange.

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
steven98Author Commented:
happened on most computer of our company. I am  Intranet site webmaster of company
0
 
cjinsocal581Commented:
HEre is the code on the page I provided:

____________________________________________________________
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>LINK</title>
</head>
<body>
<p><a target="_blank" href="ipocrm.pdf">LINK</a></p>
</body>
</html>
_________________________________________________________________
0
 
dougdayCommented:
What happens when you access is locally on your own computer?  i.e. save the pdf on your desktop, and build an html file on your desktop to access it.  Same problem, or does it go away?

-Doug
0
 
steven98Author Commented:
no problem on my local computer.

The Server is, Win2000 Server SP4, IIS 6.0
0
 
dougdayCommented:
Hm... it sounds like there's a problem accessing it over the network then.

Does this only break with Internet Explorer, or does it break with all browsers?
0
 
cjinsocal581Commented:
The target="blank" is a generic call to open a new internet browser window.

It doesn't sound like a browser issue since the link I provided opens normally.

It would have to be traced with a sniffer or something else like a app monitor.
0
 
dougdayCommented:
It could be a browser issue, since IE handles opening PDF files inside of IE differently than other browsers.  Especially if your web server is sending some certain headers it could behave erratically in IE.
0
 
jessegivyCommented:
DUDE!!!!!!

I have been experiencing a similar problem with pdf files.  It requires me to select the application to open it with.  The only difference that I noticed between your code and cjinsocal581 is that the target property is before the href property.  I changed it in one of my pages and it works now.

Give it a try,

JI
0
 
steven98Author Commented:
All the client use Reader 6.0 or later edition.  And IE 6.0 sp1.

Local Intranet. 100mb band.

Sometimes ok, sometimes blank page. (same source code <A href="myfiles/abc.pdf" target=_blank>ABC2005</a>)


I am dying
0
 
RoonaanCommented:
Steven,

One thing that might be in play is the fact wether or not you uploaded the PDF file using a script, or using a FTP client.
On one of my clients webpages, some PDF do not work when we upload them using a <form>, while replacing the pdf file using an ftp client, suddenly the sky turns blue!

-r-
0
 
steven98Author Commented:
Thank for your comment

some PDF files in web server, some in another server(not web server)

both use "Drive Mapping" to upload.
0
 
jessegivyCommented:
I'm tellin' ya, just do it, I know it doesn't make any sense but change your anchor tag from

<A href="myfiles/abc.pdf" target=_blank>ABC2005</a>

To:

<A target=_blank href="myfiles/abc.pdf">ABC2005</a>

putting the target="_blank" before the href property totally solved the issue I was having.  I think it is a browser issue Microsoft is the one that is killing you.  Explorer is very picky.  It should make a damn bit of difference the order in which you set the properties of your anchor tag but just give it a try!!!

JI

P.S. my pdf is dynamically generated but It's still just opening a pdf and my problem (similar to yours - inconsistant results when opening) was solved by swapping the target and href. again that's the only difference between your code and cjinsocal581's link that worked on your machine. Try it, try it, try it, I know it sounds like lunacy but it works!
0
 
CIC AdminCommented:
Are you opening the pdf inside your browser or does it open up in Acrobat Reader?  We were having similar problems with IE showing blank pages, but when we turned off browser integration, the problem went away.  This was for our intranet, so we could control these settings.  Of course you won't have as much luck if this is for general consumption.

It's also a little more robust to open the PDF up directly in Reader rather than inside IE as you have more control over your environment.  (saving, printing, etc.)

To turn off browser integration, open up Acrobat Reader and go to EDIT| Preferences | Internet and then uncheck "Display PDF in browser".

(For Acrobat Reader 5.0 it is EDIT | Preferences | General | Options and then uncheck "Display PDF in browser".)

Hope this keeps you alive,
Kent
0
 
Michel PlungjanIT ExpertCommented:
Also the length of the url is important  -too long and IE chokes...
0
 
DarthModCommented:
PAQed with points (75) refunded

DarthMod
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 4
  • 3
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now