如何从环聊按钮获取环聊网址 [英] how to get a hangout url from the hangout button

查看:119
本文介绍了如何从环聊按钮获取环聊网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的网站上启动环聊后将环聊网址存储在变量中。我正在使用这个:

I want to store the hangout url in a variable after the hangout is initiated on my website. I am using this:

<head>
  <script src="https://apis.google.com/js/platform.js" async defer></script>
</head>

<body>
  <g:hangout render="createhangout" 
   initial_apps="[{ app_id : '184219133185', start_data : 'dQw4w9WgXcQ' }]"             widget_size="175">
  </g:hangout>
</body>

I知道我必须使用gethangoutUrl()我只是不知道使用它的语法。或者在哪里使用它。

I know I have to use gethangoutUrl() I just don't know the syntax to use it in. Or where to use it.

推荐答案

答案是:在小工具或xml文件中。

The answer is: In the gadget or xml file.

您呈现按钮时,没有任何内容返回到您的网站,它全部都在环聊中。在start_data变量中传递令牌,然后在启动环聊的xml中,您将希望将其用作ajax回调到应用程序的键以及您希望与该已启动的环聊相关联的任何其他gapi.hangout数据。

Nothing gets returned to your website that you render the button, it is all in the hangout itself. Pass a token in the start_data variable and then in the xml that launches the hangout, you will want to use that as the key in an ajax call back to your app along with any other gapi.hangout data you want associated with that initiated hangout.

var registerHangout = function() {
  var hangoutUrl = gapi.hangout.getHangoutUrl();
  var callbackUrl = 'http://yourwebsite.com/hangout_registration';
  var startData = gapi.hangout.getStartData();

  $.ajax({
    type: "POST",
    url: callbackUrl,
    success: successFunc,
    dataType: 'json',
    data: JSON.stringify({
            "hangoutUrl": hangoutUrl,
            "startData": startData
           })
  });
}

这篇关于如何从环聊按钮获取环聊网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆