如何使用 iframe 将 Google 网上论坛嵌入到网页中?

问题描述 投票:0回答:2

我担心我面临着与之前的海报相同的挑战:

嵌入 Google 群组 - 未登录 Google 时不显示任何内容

如何将 Google 群组嵌入网页

第一个已解决,但第二个尚未解决。

想要将 google-group 论坛嵌入到 html 页面中。我无法按照 Google 网上论坛使用

iframe
提供的指导来执行此操作:

<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/test-distance'
 + '&showsearch=true&showpopout=true&showtabs=false'
 + '&parenturl=' + encodeURIComponent(window.location.href);
</script> 

并成功通过http://www.jqcoolgallery.com/support.html展示。我可以查看这个嵌入式论坛,但是当在我的 html 中应用相同的语法时,我没有成功。

在 Firefox 27 或 Internet Explorer 11 中查看时,我也同样缺乏成功。

iframe embedding google-groups
2个回答
0
投票

你的例子对我来说效果很好,看到这个jsfiddle

下面是完整的示例代码

<!DOCTYPE html>

<head>
  <title>Test</title>
</head>

<body>
<div>
  <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/test-distance'
 + '&showsearch=true&showpopout=true&showtabs=false'
 + '&parenturl=' + encodeURIComponent(window.location.href);
  </script>
  </div>

</body>
</html>

截图enter image description here


0
投票
<iframe id="forum_embed" src="https://groups.google.com/forum/embed/?place=forum/NAMEOFYOURGROUP#!forum/NAMEOFYOURGROUP" scrolling="no" frameborder="0" width="100%" height="700"></iframe>

这对你有用,就像对我一样。 是的 NAMEOFYOURGROUP 在该 iframe 上出现两次。 不要忘记将 NAMEOFYOURGROUP 更改为您的群组名称。

© www.soinside.com 2019 - 2024. All rights reserved.