views:

1461

answers:

3

I'm attempting to embed a PDF file into a HTML page using the object tag. The following HTML crashes Firefox 3.0.7:

<object id="pdfObject40" type="application/pdf" data="/file.ashx?id=40" width="432" height="600">
  <param name="src" value="/file.ashx?id=40" />
</object>

I don't have a problem in Internet Explorer.

A: 

Check the MIME-type the ‘file.ashx’ script is returning. If it's something other than application/pdf, or Content-Disposition is getting sent, there might be wrinkles.

Otherwise, it can only be (a) something odd in the document — do other documents load OK? — or (b) your setup.

In any case I would personally avoid ever embedding a PDF in a web page. A PDF plugin is a pretty inconvenient way to view a document, and the Adobe Reader plugin in particular is both historically awfully unreliable in IE, and also an ongoing security disaster. I'm advising all my clients to uninstall it ASAP.

bobince
it's for an internal app
craigmoliver
and the MIME type is correct
craigmoliver
A: 

I ended up using that code for IE and failing over to a link with a about:blank in Firefox. If any has a solution, feel free to add. I'll accept it down the road.

craigmoliver
A: 

Incase anyone else has this problem, I ended up using object element tag with Firefox and embed element tag with everything else.

I think if I'd not been serving the PDF through an .ashx I could have used the embed tag for everything.

See: http://blogs.adobe.com/pdfdevjunkie/2007/08/using_the_html_embed_tag_to_di.html

ABurt