久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Google Drive API,無法通過 JS 打開標(biāo)準(zhǔn)共享對話框

Google Drive API, can#39;t open standard sharing dialog via JS (x-frame-options error)(Google Drive API,無法通過 JS 打開標(biāo)準(zhǔn)共享對話框(x-frame-options 錯誤))
本文介紹了Google Drive API,無法通過 JS 打開標(biāo)準(zhǔn)共享對話框(x-frame-options 錯誤)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一個使用 Google Drive API 的 JavaScript 應(yīng)用.我在這里閱讀了如何打開標(biāo)準(zhǔn)共享對話框:https://developers.google.com/驅(qū)動器/網(wǎng)絡(luò)/管理共享

I have a JavaScript app which uses the Google Drive API. I read how to open a standard sharing dialog here: https://developers.google.com/drive/web/manage-sharing

<head>
...
<script type="text/javascript" src="https://apis.google.com/js/api.js"></script>
<script type="text/javascript">
    init = function() {
        s = new gapi.drive.share.ShareClient('<MY_APP_ID>');
        s.setItemIds(["<MY_FILE_ID>"]);
    }
    window.onload = function() {
        gapi.load('drive-share', init);
    }
</script>
</head>
<body>
    <button onclick="s.showSettingsDialog()">Share</button>
</body>

似乎我做的一切都是正確的,當(dāng)我點擊我的 share 按鈕時,對話框開始加載但無法加載.

Seems like I do everything right, when I click my share button, the dialog starts loading but it can't be loaded.

在我看到的控制臺中:

Refused to display 'https://drive.google.com/share?...' in a frame
because it set 'X-Frame-Options' to 'SAMEORIGIN'.

我用谷歌搜索了這個錯誤,我發(fā)現(xiàn)在 SO 和其他網(wǎng)站中有一些類似的問題,但它們沒有幫助.我猜谷歌不允許自己出現(xiàn)在非谷歌網(wǎng)站的框架中(因為SAMEORIGIN").

I've googled this error and I've seen that there are some similar questions in SO and other sites, but they don't help. I guess Google doesn't allow itself to be in a frame in a not-google-site (cause of "SAMEORIGIN").

如何在我的應(yīng)用中打開共享對話框?

What can I do to open sharing dialog in my app?

推薦答案

在您的應(yīng)用中啟動 Google Drive 共享對話框"頁面 這里 聲明:

The "Launching the Google Drive sharing dialog in your app" page here states:

啟動對話框的頁面的 URL 必須具有相同的來源作為為應(yīng)用注冊的開放 URL.

The URL of the page that launches the dialog must have the same origin as the Open URL registered for the app.

如果您隨后查看配置 Drive SDK"的說明這里,您可以看到打開 URL"部分顯示為:

If you then look at the instructions to "Configure the Drive SDK" here, you can see that the "Open URL" section reads:

Open URL 有兩點需要牢記:

There are two important things to keep in mind for the Open URL:

  • 確保為 Open URL 提供完全限定的域名 - localhost 不起作用.
  • 該網(wǎng)址必須屬于您.應(yīng)用注冊完成后,您需要驗證您對該 URL 的所有權(quán),以便創(chuàng)建一個Chrome 網(wǎng)上應(yīng)用店列表.如需更多信息,請參閱網(wǎng)站驗證.

因此,您正在啟動對話框的頁面與您在 Google Drive SDK 設(shè)置中為應(yīng)用注冊的打開 URL 具有相同的來源.因此,要解決您的問題,請更正 Open URL,使其具有正確的 URL,即與 Open URL 具有相同來源的 URL.請注意,您可以通過 https://console.developers.google.com/project<更改 Google Drive SDK 設(shè)置/a>.

Hence your page which is launching the dialog does not have the same origin as the Open URL registered for the app in you Google Drive SDK settings. So to fix your problem correct the Open URL so that it has the correct URL i.e. a URL with the same origin as the Open URL. Note that you can change the Google Drive SDK settings via https://console.developers.google.com/project.

以及確保正確設(shè)置打開 URL.您還需要將 Drive SDK 應(yīng)用 ID 替換為MY_APP_ID".您可以按照以下說明找到 App ID:

As well as making sure the Open URL is set correctly. You'll also need to substitute your Drive SDK app ID for 'MY_APP_ID'. You can find the App ID by following these instructions:

  1. 轉(zhuǎn)到 https://console.developers.google.com
  2. 點擊您的項目
  3. 點擊左側(cè)的APIs and auth"
  4. 點擊Drive SDK"設(shè)置齒輪圖標(biāo)
  5. 然后可以在Google Drive SDK"標(biāo)題下找到App ID",例如應(yīng)用 ID:47XXXXXXX3

這篇關(guān)于Google Drive API,無法通過 JS 打開標(biāo)準(zhǔn)共享對話框(x-frame-options 錯誤)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機(jī)器人提及發(fā)出該機(jī)器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務(wù)器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時的歡迎消息)
主站蜘蛛池模板: 啪啪免费网站 | 久久国产欧美一区二区三区精品 | www.精品一区 | 免费观看日韩精品 | 三级在线观看 | 国产精品久久久久999 | 国产精品成人一区二区三区 | 中文字幕乱码一区二区三区 | 狠狠av| 久久av在线播放 | 亚洲 中文 欧美 日韩 在线观看 | 亚洲福利在线观看 | 99视频精品 | 精品在线观看一区二区 | 暴草美女| 国产91成人 | 欧美八区| 日韩免费中文字幕 | 免费观看成人性生生活片 | 在线观看视频h | 欧美精品在线免费观看 | 亚洲精品电影网在线观看 | 国产剧情一区 | 国产在线精品一区二区三区 | 黄色一级视频 | 一级全黄少妇性色生活免费看 | 久久一区二区av | 色.com| 99久久精品国产麻豆演员表 | 亚洲精品在线观 | 99久久久久久 | 国产区在线视频 | 亚洲精品在线视频 | 99九九久久 | 精品国产一区二区国模嫣然 | 午夜影院 | 亚洲成人av | 免费中文字幕 | 精品亚洲一区二区 | 国产视频中文字幕 | 国产剧情一区 |