Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML5 Doctype IE9 #11

Closed
jwagner79 opened this issue Jan 12, 2012 · 4 comments
Closed

HTML5 Doctype IE9 #11

jwagner79 opened this issue Jan 12, 2012 · 4 comments

Comments

@jwagner79
Copy link

In my testing I've found that using an object to embed the PDF doesn't work for Adobe reader in IE9 (or maybe it's just me: IE9, Adobe Reader 9.5 or X, Windows 7 x64).

Try the following for example:

<!doctype html>
<html>
<body style='height: "100%"; width: "100%"'>
<object type='application/pdf' width='500' height='500' data='http://www.irs.gov/pub/irs-pdf/fw4.pdf'></object>
</body>
</html>

However, using an iframe works fine for HTML 5 doctype. I'm not sure if you can reliably detect the doctype in javascript with IE, but one option would be to use an iframe rather than object if the browser supports ActiveX. Something like this in the embed method:

if (hasReaderActiveX()) 
  targetNode.innerHTML = '<iframe src="' + url + '" width="' + width + '" height="' + height + '"></iframe>';       
else 
   targetNode.innerHTML = '<object    data="' +url +'" type="application/pdf" width="' +width +'" height="' +height +'"></object>';
@pipwerks
Copy link
Owner

Thanks for the info... from what I've seen, both PDFObject and SWFObject have issues in IE9 on Win7 64bit. I think it may be an IE9 64bit bug when handling an <object>.

@jwagner79
Copy link
Author

Agree that's an IE9 bug, but I've seen it on 32 bit as well. I found that if I modified the embedding to use an iframe I could get around the issue. Something like

if (hasReaderActiveX()) {
 targetNode.innerHTML = '<iframe src="' + url "' width="' +width +'" height="' +height +'"></iframe>';
}
else {
 targetNode.innerHTML = '<object    data="' +url +'" type="application/pdf" width="' +width +'" height="' +height +'"></object>';

}

@cramhead
Copy link

I have a similar problem on IE9 in Browser Mode IE9, Document Mode IE9 standards. The pdf window ends up blank. It seems the request to the server that the object's data attribute specifies is not happening on. It does happen in Chrome, Firefox and the other modes available on IE.
The funny thing is that on your sample pages work fine in Browser Mode IE9, Document Mode IE9 standards.

I've made sure that pdfobject.js is loaded first and even stepped through the pdfobject code. It runs fine.
When dealing with an object tag not refreshing when I changed the data attribute, I had actually had to create a new element and replace the old object tag. I see that you're adding the object tag via the innerHtml. Maybe that's somehow related.

When I change the object tag with the data attribute to an embed tag with a src attribute it works, it makes the call for the pdf and renders.

@pipwerks
Copy link
Owner

pipwerks commented Jan 5, 2015

I am investigating switching to <embed> now that a couple of years have passed and HTML5 is considered safe for production. (HTML5 officially supports <embed>, so PDFObject will remain standards-based if the switch is made, which is important to me.)

@pipwerks pipwerks closed this as completed Jan 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants