0

I want to add a Google Drive folder view and download to my website hosted in Wordpress.com. I followed the instructions in this question using this command:

<iframe src="https://drive.google.com/embeddedfolderview?id=FOLDER-ID#list" style="width:100%; height:600px; border:0;"></iframe>

But for some reason it works when I preview it, but not when I publish it. Does anyone know how I can fix this?

This is the code in html

The preview works

But when I publish it, this is the result

Pablo Viollier
  • 109
  • 1
  • 2
  • Can you try opening the console (Ctrl+Shift+i) and seeing if there is any log/message related to this? – carlesgg97 Oct 08 '19 at 07:21
  • @carlesgg97 sorry for my lack of knowledge, but could you indicate me how to do that? – Pablo Viollier Oct 10 '19 at 06:33
  • Sure! Please head over to your webpage (after publishing it with the embedded folder). There, hit the keys (Ctrl, Shift, i) at the same time and a window should open to the right of your browser (Otherwise open the drop-down settings button on the top left, click more tools and developer tools). Afterwards, select Console if it is not already selected and please tell me if there are any errors appearing there. – carlesgg97 Oct 10 '19 at 07:38
  • Otherwise, if you prefer, you can publish the URL here so I may take a look at it. – carlesgg97 Oct 10 '19 at 08:42
  • @carlesgg97 thanks for your disposition. I can't copy them all but there is a bunch of errors saying "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT" A couple that say: "Uncaught object. "{"error":{"code":-1,"message":"A network error occurred, and the request could not be completed."}}" and one that says "A cookie associated with a cross-site resource at was set without the `SameSite` attribute". The webpage is https://pabloviollier.net/docencia/ – Pablo Viollier Oct 10 '19 at 20:16

1 Answers1

0

The code you currently have in your website is as follows:

<iframe src="https://drive.google.com/file/d/1HtDl8uOzH3qLJqnZ_18HE8kXeJhwMR8k/preview?usp=drivesdk" frameborder="0" width="640" height="480" marginheight="0" marginwidth="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>

Which uses the appropriate hyperlink (right after the src=) to embed a file, rather than a directory. However, you a trying to embed the latter.

To embed a directory use the following URL:

https://drive.google.com/embeddedfolderview?id=YOUR_FOLDER_ID#grid

And if you prefer to embed a file use the following URL:

https://drive.google.com/file/d/YOUR_FILE_ID/preview

The resulting code you should use in order to embed your folder would be as follows:

<iframe src="https://drive.google.com/embeddedfolderview?id=1HtDl8uOzH3qLJqnZ_18HE8kXeJhwMR8k#grid" frameborder="0" width="640" height="480" marginheight="0" marginwidth="0" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
carlesgg97
  • 4,184
  • 1
  • 8
  • 24
  • 1
    Thanks for the reply and your time! I used your code, but it still doesn't work :( It seems the problem is that I use wordpress.com without a business plan https://en.forums.wordpress.com/topic/embedding-a-google-drive-folder-in-wordpress-com/#post-3378700 – Pablo Viollier Oct 11 '19 at 21:02