user3006575
user3006575

Reputation: 157

Google Views in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

<iframe src='https://docs.google.com/viewer?url=https://docs.google.com/document/d/125CJmmlBfy7UgfYuBAmb1_HSCuyz8NV133361KTK1SE/export?format%3Dpdf&id=125CJmmlBfy7UgfYuBAmb1_HSCuyz8NV133361KTK1SE&embedded=false'  frameborder='0'></iframe>

after this code I have next error

Refused to display 'https://docs.google.com/a/myrussiaonline.ru/viewer?url=https://docs.google.…ormat%3Dpdf&id=125CJmmlBfy7UgfYuBAmb1_HSCuyz8NV133361KTK1SE&embedded=false' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

If I set

<iframe src='https://docs.google.com/viewer?url=https://docs.google.com/document/d/125CJmmlBfy7UgfYuBAmb1_HSCuyz8NV133361KTK1SE/export?format%3Dpdf&id=125CJmmlBfy7UgfYuBAmb1_HSCuyz8NV133361KTK1SE&embedded=true'  frameborder='0'></iframe>

Then, all fine

Can I set &embedded=false and have correct render without error?

Thanks

Upvotes: 15

Views: 15170

Answers (4)

S M Abrar Jahin
S M Abrar Jahin

Reputation: 14578

Try this tutorial-

https://www.youtube.com/embed/A5SkbcId-v0

U should have your answer.

Update-

According to Google Policy, if u like to have your document viewed with a iFrame, then embedded=true should be in the URL.

Demo Code-

<iframe src='https://docs.google.com/viewer?url=https://docs.google.com/document/d/125CJmmlBfy7UgfYuBAmb1_HSCuyz8NV133361KTK1SE/export?format%3Dpdf&id=125CJmmlBfy7UgfYuBAmb1_HSCuyz8NV133361KTK1SE&embedded=true'  frameborder='0'></iframe>

Upvotes: 3

El Fadel Anas
El Fadel Anas

Reputation: 1721

First you should go to your document on google drive :

  1. click file
  2. publish to the web
  3. embed
  4. publish

You will get the code of the iframe you can use it to visualize your spreadsheet without the possibility to edit it

Upvotes: 1

mikeagoff
mikeagoff

Reputation: 386

The only way I've found to get the Google Docs Viewer to work in an iframe is:

<iframe src="https://docs.google.com/viewer?srcid=[YOUR_FILE'S_ID_HERE]&pid=explorer&efh=false&a=v&chrome=false&embedded=true" width="800" height="600" style="border: none;"></iframe>

Upvotes: 8

Andriy Kuba
Andriy Kuba

Reputation: 8263

No, you can not, this parameter is specify that source would be embedded. And the idea behind using it is to avoid clickjacking attacks

Upvotes: 0

Related Questions