# 能否通过 iframe 将 Discourse 嵌入 Salesforce Community（Experience Cloud 站点）？如果可以，具体如何操作？

**URL:** https://meta.discourse.org/t/is-it-possible-to-embed-discourse-into-a-salesforce-community-experience-cloud-site-using-an-iframe-if-yes-how/402712
**Category:** Support
**Tags:** embedding, salesforce
**Created:** [2026年五月11日 22:55 UTC](https://meta.discourse.org/t/is-it-possible-to-embed-discourse-into-a-salesforce-community-experience-cloud-site-using-an-iframe-if-yes-how/402712 "2026-05-11T22:55:55Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Pavel\_Kravets](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pavel_kravets/32/543103_2.png) [@Pavel\_Kravets](https://meta.discourse.org/u/Pavel_Kravets)
#### Post date: [2026年五月11日 22:55 UTC](https://meta.discourse.org/t/is-it-possible-to-embed-discourse-into-a-salesforce-community-experience-cloud-site-using-an-iframe-if-yes-how/402712/1 "2026-05-11T22:55:56Z")

</div>

我正在使用商业试用版，并参考了这篇[文章](https://meta.discourse.org/t/embed-discourse-as-a-full-comment-system-on-your-site/399743)。LWC 被用作 Discourse 的包装器。由于 LWC 不允许在 HTML 标记中添加 和 标签，我从 [myDiscourseAcc.discourse.group/javascripts/embed.js](http://myDiscourseAcc.discourse.group/javascripts/embed.js) 下载了 JavaScript 库，将其保存到我的 Salesforce 组织中作为静态资源，并加载到 LWC 中。

iframe 可以显示，但它总是显示登录页面和“登录以回复”按钮。但我需要显示论坛及其所有功能——目前无法实现。

1. 在 LWC 中，我为 window.DiscourseEmbed 指定了 discourseUrl、discourseEmbedUrl 和 fullApp（设置为 true）。
2. 已在管理员设置 → 嵌入 → 主机中添加了 Salesforce 社区站点。已启用完整应用模式。
3. [Discourse Connect](https://meta.discourse.org/t/13045?silent=true) 工作正常，相关设置也已配置。我得出这一结论是因为我可以通过 SF 社区访问 Discourse，并且当我登录时，可以使用我的社区用户自动登录到 Discourse。
4. 在 Salesforce 组织中，Discourse 已被添加到受信任的 URL 中。
5. 登录社区时，SF 社区日志和 Discourse 日志中均未出现任何错误。
6. 加载社区时，我可以设置重定向到 Discourse 再返回，以便通过 URL 获取 SSO 和 SIG。
7. 当我点击自定义按钮或嵌入的 Discourse iframe 中的“登录以回复”按钮时，我可以在单独的窗口或标签页中打开 Discourse。
8. Salesforce 社区和我的 Discourse 实例位于 **不同的域名** 上。

尽管如此，登录页面仍然在嵌入的 iframe 中打开。我不太确定，但问题可能与 Cookie 有关。

---

_[View the full topic](https://meta.discourse.org/t/is-it-possible-to-embed-discourse-into-a-salesforce-community-experience-cloud-site-using-an-iframe-if-yes-how/402712)._
