Search code examples
cssgoogle-drive-apigoogle-docs-api

A problem displaying Google Drive on my site


I want to view the Doc file in Google Drive on my site i did

<iframe id="cv" src="https://drive.google.com/file/d/1fWg9CtbsObRpCsGHpBRPGNFrQxfdK1Fl/view?usp=sharing">  </iframe>

A problem is that the browser shows me : We cannot display this content in a frame Content normally appears in this location. However, the publisher prohibits its display in a frame to help you preserve any information entered on this site. Try Open in a new window Report this issue. When you press Open in a new window It appears but with a full screen. "Do not respect height and width."


Solution

  • I opened the link normally in my browser. On the upper right corner, I can see three dots. Click it, then click embed item. A popup with html code segment will appear like this:

    <iframe src="https://drive.google.com/file/d/1fWg9CtbsObRpCsGHpBRPGNFrQxfdK1Fl/preview" width="640" height="480"></iframe>
    

    Notice that this link is a little different than the link in your question because this one ends with preview but your link ends with sharing. Anyway, try this code segment and change height width. I hope this will work. :)