How can I embed a Google Docs collection in an Iframe?

13,572

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):

enter image description here

Share:
13,572
cwd
Author by

cwd

Updated on June 05, 2022

Comments

  • cwd
    cwd almost 2 years

    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
    

    screenshot-with-shadow.png

    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"

    1. You can click on the "Share" button and set visibility, which will give you a link to a document
    2. Or you can click on "Publish to Web" and it will give you a link or an iframe option.

    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.

  • Unapedra
    Unapedra over 10 years
    It seems that Google only allows that if you are logged in.