2

I'm trying to show docs, pdfs, and sheets from google drive in my website, then I'm using the following code:

<iframe src="https://docs.google.com/viewer?srcid=[FILE ID]&pid=explorer&efh=false&a=v&chrome=false&embedded=true" style="width: 100%; height: 92vh;border: none;"></iframe>

When I'm logged in the account owner of the file, it work just fine, but when I'm not, it try to redirect me to a login page, but gives the error:

Refused to display 'https://drive.google.com/accounts?continueUrl=https://drive.google.com/file/d/[FILE ID]/preview&ddrp=1#' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

Anybody knows why I got that error? I'm doing something wrong?

Shukizu
  • 56
  • 1
  • 5
  • Possible duplicate of [How to set 'X-Frame-Options' on iframe?](https://stackoverflow.com/questions/27358966/how-to-set-x-frame-options-on-iframe) – Linda Lawton - DaImTo Apr 30 '18 at 14:05
  • Yeah it is... but nobody answer the question yet... the solution in this article don't work to me – Shukizu Apr 30 '18 at 14:21
  • If all else fails, try this chrome extension called [Allow-Control-Allow-Origin](https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi/reviews?hl=en) to solve X-Origin issues. – ReyAnthonyRenacia May 01 '18 at 10:00

0 Answers0