【问题标题】:How to embed Google Groups forum into web page using iframe?如何使用 iframe 将 Google Groups 论坛嵌入网页?
【发布时间】:2014-04-05 18:28:28
【问题描述】:

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

Embedding a Google Group - nothing is displayed when not logged into Google

How to embed google groups to a web page

第一个解决了,第二个没解决。

希望将 google-group 论坛嵌入到 html 页面中。我无法按照 Google Groups 使用 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


    【解决方案1】:
    <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 更改为您的组名。

    【讨论】:

    • 这在过去可能有效,但从 2021 年起,Google 网上论坛不再支持嵌入,至少不支持这种方式。
    【解决方案2】:

    你的例子很适合我,see this 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>
    

    截图

    【讨论】:

    • 尝试在我的机器上使用此代码但没有成功。页面加载没有错误,但显示没有内容的空白页面。
    • this page 使用相同的代码,这对您有用吗?应该是浏览器的问题?您使用的是哪个浏览器?我刚刚添加了 jsfidde 使用 Windows 7 和 Chrome 的屏幕截图
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-24
    • 1970-01-01
    • 2019-11-28
    • 2017-08-08
    • 1970-01-01
    • 2018-06-09
    • 2017-01-04
    相关资源
    最近更新 更多