6

I am having an issue with viewing a PDF in an object element in Chrome. The initial PDF loads, but when I go to a different HTML, then HREF, it will not display. I 'think' I am getting the following error because Chrome uses an external viewer and thinks I am crossing domains. I do not get this error in FF or IE.

Refused to display 'https://docs.google.com/viewer?url=http%3A%2F%2Fleaderpaper.com%2Fleader%2Fspecs%2F10-openend.pdf' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

My current workaround is to give the HREF a _blank target attribute which opens in a new tab. Have I done all I can??

7
  • "when I go to a different HTML, then HREF, it will not display" - what do you mean by this? "then HREF"? You aren't requesting a PDF directly, you are trying to display the output of the Google Docs PDF viewer, which is plain old HTML. So, I don't see how this has anything to do with Chrome's internal PDF viewer. Same origin policy still applies though.
    – DocRoot
    Apr 21, 2016 at 22:43
  • I have an object with that displays an HTML page with an HREF to a PDF. Apr 22, 2016 at 14:40
  • You mean you are linking to a PDF in an anchor? And "then HREF" refers to clicking on this anchor?
    – DocRoot
    Apr 22, 2016 at 14:48
  • The initial call is through JS, but that should not matter. My understanding is that Chrome does not support local PDF plugin, therefore it uses the Google Docs viewer, which as you can see from the error is in a different domain than leaderpaper.com. Apr 22, 2016 at 14:49
  • 1
    @DocRoot Yes. <td><a href="/leader/specs/10-openend.pdf" target="_blank"><img class="pdf" src="/leader/img/pdf.png" alt="PDF" /></a> Apr 22, 2016 at 14:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.