【问题标题】:How to get share function to work with gapi如何让共享功能与 gapi 一起使用
【发布时间】:2015-08-16 20:48:22
【问题描述】:

使用 gapi 的分享功能时出错。

在 drive_sdk 中打开 Url:

http://docswriter.com/#/edit/{ids}

该页面也在谷歌搜索控制台中被验证为:

docswriter.com

js中的分享功能:

factory.share = function(fileid) {
        var appid = '***********'; //Using App ID from Drive UI Integration
        var init = function() {
            var s = new gapi.drive.share.ShareClient(appid);
            s.setItemIds([fileid]);
            s.showSettingsDialog();
        }
        gapi.load('drive-share', init);
    };

错误:

拒绝显示 'https://drive.google.com/sharing/share?id=10RAw2XV2n3qizC237Z_HoXcbeeWeuEDS…ient=postMessage&appId=***********&embedOrigin=http%3A%2F%2Fdocswriter.com' 在一个框架中,因为它将“X-Frame-Options”设置为“SAMEORIGIN”。

【问题讨论】:

    标签: google-drive-api share google-api-js-client


    【解决方案1】:

    问题已通过在清单文件中使用应用程序 ID 创建一个 chrome web store listing 来解决,如下所示:(app id as api_console_project_id)

    {
      "name": "Docswriter",
      "description": "App to write documentation",
      "version": "0.0.0.2",
      "manifest_version": 2,
      "api_console_project_id" : "4********3",
      "icons": {
        "128": "icon_128.png"
      },
      "app": {
        "urls": [
          "http://docswriter.com/"
        ],
        "launch": {
          "web_url": "http://docswriter.com/"
        }
      }
    }
    

    当我从 chrome 网上商店安装该应用程序后,它就可以工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-05
      • 2019-06-13
      • 1970-01-01
      • 2021-09-24
      • 2018-03-15
      • 1970-01-01
      • 2017-09-04
      • 2019-06-07
      相关资源
      最近更新 更多