Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to detect if a pdf in object tag is loaded

Status
Not open for further replies.

raghu3

Programmer
Dec 19, 2005
96
US
This this code will explain:

<object type="application/pdf" height=600 width=900 data= somesite.com/show_pdf.pdf >
</OBJECT>


If the adobe reader is not on client, It comes up with the notfound icon:red X in a white box.
How can I detect that the object was loaded ?

On netscape/firefox I can check if adobe reader is installed on client. But need to run an ActiveX script for IE which is most probably not allowed by client's PC.
 
will this work?:
Code:
<html>
<head>
<script language=JavaScript>
<!--
 var it_loaded;
 function doLoadCheck()
 {
  if (it_loaded)
  {
   Alert('Your Object Loaded Successfully');
  };
 };
//-->
</script>
</head>
<body>
<object type="application/pdf" height=600 width=900 data=[URL unfurl="true"]http://www.[/URL] somesite.com/show_pdf.pdf onLoad="document.it_loaded = true; doLoadCheck();"></OBJECT>
</body>




I hope this helps;
Rob Hercules
 
But need to run an ActiveX script for IE which is most probably not allowed by client's PC.

If the ActiveX controls are "not allowed", then your object tag won't load either, will it?

So if your object tag loads, you know that ActiveX is supported, and you can use the code in the article I gave you in the thread you started a few days ago.

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks Robherc, onLoad does not work, But onError works
onError="javascript:noAdobe();"

where noAdobe function will redirect to some other pages.

AGAIN
onError does not get fired on netscape/firefox.

This is cross browser:
<OBJECT
type="application/pdf" height=600 width=900
data=" VIEWASTEXT>
Sorry Adobe Acrobat reader is required.
</OBJECT>


The sorry comes up on all browsers.
Thanks again, appreciate the quick help.

Was going in circles to do this neatly. Did not like browser plugin check as I need an activeX script for IE.

The VIEWASTEXT is inserted by VS2003
 
hi Dan,
I did test the vbscript, it does not run if activeX is not allowed. But the Object shows the text message!. I am not suree how this will work on Mac. I know for sure once my project goes live, there will be some tweaking on this issue as we have a variety of PCs/OS: PC, MAC, Windows NT to XP.
Thanks again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top