Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 254
user3006575 Avatar asked Sep 27 '14 21:09

user3006575


People also ask

What is SAMEORIGIN in X-Frame-options?

X-Frame-Options:SAMEORIGIN - This means that the page can only be embedded in a frame on a page with the same origin as itself. X-Frame-Options:ALLOW-FROM - The page can only be displayed in a frame on the specified origin. This only works in browsers that support this header.

Is a Frame because it set X-Frame-options to SAMEORIGIN?

The error indicates that either the application has set an X-Frame-Options header to SAMEORIGIN or Chrome browser did. This means that the application has disallowed loading of the resource in an iframe outside of its domain.

How do I remove X-Frame-options in SAMEORIGIN?

You can remove the HTTP header X-Frame-Options: SAMEORIGIN from WordPress by removing the send_frame_options_header function from the admin_init and login_init hooks.

How do I add X-Frame-options in SAMEORIGIN?

Double-click the HTTP Response Headers icon in the feature list in the middle. In the Actions pane on the right side, click Add. In the dialog box that appears, type X-Frame-Options in the Name field and type SAMEORIGIN in the Value field. Click OK to save your changes.


1 Answers

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>
like image 176
mikeagoff Avatar answered Sep 22 '22 13:09

mikeagoff