【问题标题】:Not able to add Hangout button using APIs in my page无法在我的页面中使用 API 添加环聊按钮
【发布时间】:2015-10-31 11:09:28
【问题描述】:

我正在尝试添加一个基本的环聊按钮组件,它将启动 Google 的环聊。我正在遵循Google Developer 中提到的步骤,但经过所有努力,我正在努力解决以下问题:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null').(anonymous function) @ core:rpc:shindig.random:shindig.sha1.js?c=2:838
3cb=gapi.loaded_0:112 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('file://') does not match the recipient window's origin ('null').(anonymous function) @ cb=gapi.loaded_0:112

这是我用来在页面中开发环聊按钮的 sn-p:

<script src="https://apis.google.com/js/platform.js"></script>
    <div id="placeholder-div"></div>
    <script>
    window.____gcfg = {
      lang: 'en-US',
      parsetags: 'onload'
    };
      gapi.hangout.render('placeholder-div', {
          'render': 'createhangout',
          'initial_apps': [{'app_id' : '902502537504'}],
          'widget_size': 175
        });
    </script>

我还使用 https://console.developers.google.com/project/grabhouseportal/apiui/apiview/plusHangouts/overview 启用了我的 google+ 环聊服务

感谢任何帮助。

【问题讨论】:

    标签: javascript html google-api hangout


    【解决方案1】:

    注意file://。不要直接用浏览器打开html文件。您需要运行本地 Web 服务器并导航到 localhost 以呈现 html 页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-05
      • 2022-11-01
      相关资源
      最近更新 更多