如何在网站中嵌入 Google Drive 文件夹

2022-01-10 00:00:00 google-drive-api embed html

我想在我的网站中嵌入 Google 云端硬盘中的一个文件夹.我找不到嵌入代码或 Google 云端硬盘帮助文章中记录的任何内容.

I have a folder in Google Drive that I'd like to embed in my website. I can't find an embed code or anything documented in Google Drive Help articles.

推荐答案

Google Drive 文件夹可以嵌入并显示在 listgrid 视图中:

Google Drive folders can be embedded and displayed in list and grid views:

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


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



问:什么是文件夹ID(FOLDER-ID),如何获取?



Q: What is a folder ID (FOLDER-ID) and how can I get it?

A:转到 Google Drive >> 打开文件夹 >> 在浏览器的地址栏中查看其 URL.例如:

A: Go to Google Drive >> open the folder >> look at its URL in the address bar of your browser. For example:

文件夹网址:https://drive.google.com/驱动器/文件夹/0B1iqp0kGPjWsNDg5NWFlZjEtN2IwZC00NmZiLWE3MjktYTE2ZjZjNTZiMDY2

文件夹 ID:
0B1iqp0kGPjWsNDg5NWFlZjEtN2IwZC00NmZiLWE3MjktYTE2ZjZjNTZiMDY2

Folder ID:
0B1iqp0kGPjWsNDg5NWFlZjEtN2IwZC00NmZiLWE3MjktYTE2ZjZjNTZiMDY2

此技术最适用于具有公共访问权限的文件夹.仅与某些 Google 帐户共享的文件夹在您以这种方式嵌入时会造成麻烦.在进行此编辑时,会显示一条消息您需要权限",其中一些按钮可帮助您请求访问"或切换帐户"(或可能登录到 Google 帐户).这些按钮中的 Javascript 在 Chrome 中的 IFRAME 内无法正常工作.

This technique works best for folders with public access. Folders that are shared only with certain Google accounts will cause trouble when you embed them this way. At the time of this edit, a message "You need permission" appears, with some buttons to help you "Request access" or "Switch accounts" (or possibly sign-in to a Google account). The Javascript in these buttons doesn't work properly inside an IFRAME in Chrome.

在 https://productforums.google.com/forum 了解更多信息/#!msg/drive/GpVgCobPL2Y/_Xt7sMc1WzoJ

相关文章