When opening pdf's in Chrome and Firefox, the "view source" button is greyed out. "Inspect elemet," however, reveals HTML. Are the browsers simply downloading the file and generating html to display it?

  • Why was this downvoted? Wrong forum? Commented Sep 19, 2013 at 19:31
  • I upvoted it because it was interesting to me and I learned something. Commented Sep 19, 2013 at 19:32

1 Answer 1


Firefox has used PDF.js as the default PDF viewer since Firefox 19. When you view a PDF in Firefox (provided you haven't changed your browser's PDF settings), you are viewing an HTML rendering of the document. You can't "view source" because there was no HTML source downloaded, but you can "inspect element" because the document you're viewing in-browser is written in HTML, based on the original PDF.

In Chrome (at least v29, in Windows), the browser relies on a native PDF plugin. There is HTML generated, but it looks like:

    <body><embed ...></body>

where the <embed> element holds the PDF and is rendered by a plugin. This is the same way that images are rendered standalone in Chrome. You wouldn't "view source" on an image, but Chrome allows you to inspect the minimal framing HTML that surrounds the content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.