【问题标题】:Embedding a Google Group into a website将 Google Group 嵌入网站
【发布时间】:2016-08-21 22:32:37
【问题描述】:

我正在将一个组嵌入(非 Google)网站并获得一个空白页面。

我添加了“管理您的组”提供的代码,如下所示。

<iframe id="forum_embed"
  src="javascript:void(0)"
  scrolling="no"
  frameborder="0"
  width="900"
  height="700">
</iframe>
<script type="text/javascript">
  document.getElementById('forum_embed').src =
 'https://groups.google.com/forum/embed/?place=forum/the-sophia-club'
 + '&showsearch=true&showpopout=true&showtabs=false'
 + '&parenturl=' + encodeURIComponent(window.location.href);

我尝试删除 &parenturl 没有成功。

我也尝试将代码单独保存在一个简单的 html 文档中,但它仍然给我一个空白页。

这是单页的代码...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<p>Testing</p>
<iframe id="forum_embed"
  src="javascript:void(0)"
  scrolling="no"
  frameborder="0"
  width="900"
  height="700">
</iframe>
<script type="text/javascript">
  document.getElementById('forum_embed').src =
 'https://groups.google.com/forum/embed/?place=forum/the-sophia-club'
 + '&showsearch=true&showpopout=true&showtabs=false'
 + '&parenturl=' + encodeURIComponent(window.location.href);
</script>

</body>
</html>

对出了什么问题有任何想法吗??

【问题讨论】:

    标签: iframe embedding google-groups


    【解决方案1】:

    问题是您的文档是 xhtml 而不是 html。两种标准不同,Google 似乎不喜欢 xhtml。

    不幸的是,xhtml 似乎已经死了,所以尝试更改为 html5。唯一需要的更改应该在 doctype 声明中。

    此外,当我使用指向本地目录的 Web 浏览器打开页面时,嵌入不起作用。但是,当我将页面上传到网络服务器时,它确实有效。

    【讨论】:

      猜你喜欢
      • 2010-09-15
      • 2011-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多