本文介绍了Google Drive SDK JavaScript文件共享对话框提供了“由于X-Frame-Options禁止显示而拒绝显示文档”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用此处介绍的Javascript代码来使用Google SDK文件共享对话框:
我设置了API密钥并配置了Google Drive SDK面板:
我可以使用API密钥和JavaScript成功列出存储在Google云端硬盘中的文件,但共享代码无法使用。一个仅包含加载微调器的对话框出现,然后显示很抱歉,此时共享不可用。而Chrome浏览器Javascript控制台在Chrome中包含拒绝显示文档,因为X-Frame-Options禁止显示错误。在Firefox中,我收到错误:
错误:错误:权限被拒绝访问属性'_EmailAc_create'
源文件:docs.google.com/static/ doclist / client / js / 1880332762-v2-doclist_share__en_gb.js
Line:470
任何想法出了什么问题?
b
X-Frame-Options用于防止对整个服务器发生点击劫持攻击,方法是禁止任何具有指定头部的页面进行iframed。据我所知,谷歌浏览器在指定的应用程序安装为Chrome网络应用程序时解除了这一限制,因此可能您的网页应用程序配置不当。
另外还有它可能也必须处理您的设置在控制台显然:
I'm trying to use the Google SDK file sharing dialog using the Javascript code described here: https://developers.google.com/drive/manage-sharing
I have an API key set up and have configured the Google Drive SDK panel as well: https://code.google.com/apis/console/
I can successfully list files stored on Google Drive using the API key and JavaScript but the sharing code does not work. A dialog that only contains a loading spinner appears and then it says "Sorry, sharing is unavailable at this time." and the Chrome Javascript console contains the error "Refused to display document because display forbidden by X-Frame-Options" in Chrome. In Firefox, I get the error:
Error: Error: Permission denied to access property '_EmailAc_create'Source File: docs.google.com/static/doclist/client/js/1880332762-v2-doclist_share__en_gb.jsLine: 470
Any idea what is going wrong?
解决方案
Ok, as nobody has been able to give you any advice at all, let me give you some low quality advice at least.
X-Frame-Options are used to prevent clickjacking attacks against an entire server by disallowing any pages with the specified header to be iframed. As far as I know google chrome lifts this restriction when the specified app is installed as a chrome web application, so probably your accompying web app isn't configured properly.
Additionally from another answer it could also have to do with your settings in the console apparently:
这篇关于Google Drive SDK JavaScript文件共享对话框提供了“由于X-Frame-Options禁止显示而拒绝显示文档”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!