I have a Google Docs collection that I would like to embed into an iframe:
https://docs.google.com/open?id=0B6yYgWS-CUJ2ZTUxZGI4MGUtMWM0Yy00YzY0LWIxOTMtMDFlN2RjNDAxNGM2
The problem here is that Google has set the X-Frame-Options
header and so it seems they only allow this collection to be embedded into a Google site:
X-Frame-Options: SAMEORIGIN
Now I realize Google's reasons for not allowing their content in iframes some of the time, but this is one case where I feel like it would be nice to have the ability to do this.
With documents Google also allows two methods of "sharing"
The iframe url is similar to the link URL except that it has the "&embedded=true
" query variable at the end. The same thing is true for Google Maps except the parameter is "&output=embed
"
Who while I believe there is nothing I can do with headers or Javascript on my site to allow the content of an iframe for a Google Docs collection to load, I was hoping someone might know of a way to generate embed code for a Google Docs collection which would allow it to be loaded in an iFrame.
Open your Google Document (or other Google item). Under the "File" menu, click "Publish to the Web". Copy the "iframe" code. On the page you want the Google Doc embedded, click on "Source Code" button from the WYSIWYG editor to open the HTML editor.
You can make a document, spreadsheet, presentation, or form available to view on an existing website by embedding it in your site or blog. Open a file in Google Docs, Sheets, or Slides. Publish to web. In the window that appears, click Embed.
Copy the embed code. In your site editor, add a new "App Store & HTML" section by clicking on "Add new section" from the left panel. Mouse over the newly added section, click "Edit" and select "HTML". Paste the embed code you got from your Google Doc into the HTML box and click "Save".
Update: It looks like Google has allowed embedding Google Docs/Drive items via iFrame. Here are the current headers for that page (note that this URL is after the redirect):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With