Search code examples
javascriptasp.net-mvciframesame-origin-policy

SameOrigin Policy interfering with Google Docs


I was hosting google docs in an Iframe a few months ago to allow users to pull some PDFS down, but recently I noticed that the iframes I used to show the PDFs are throwing console errors for the SameOrigin Policy preventing the documents from loading. Is there any way around this?

I built the website using asp.net mvc

It would be a handful of iframes to the effect of:

<iframe src="https://docs.google.com/SamplePDFURL" frameborder="0"></iframe>

The error looks like

Refused to display https://docs.google.com/SamplePDFURL in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.


Solution

  • Try adding &embedded=true to the end of your URL as stated here.