How to embed a Google Form?

I’ve been trying without success to embed a Google Form. The embed code provided by Google Forms is an iframe. Is this compatible with Discourse?

1 个赞

It is - you’ll have to allow the https://docs.google.com as the source domain prefix in allowed iframes.

Search for iframe in your Discourse settings.

11 个赞

Works great. Thanks.

2 个赞

Good to know. What are the risks connected to whitelisting https://docs.google.com for iframes? It’s a pretty huge and diverse domain…

I don’t know. Perhaps someone from the Discourse team can answer how iframes are walled off from the application.

Whitelisting could be narrowed down to the specific form, though. For example, this will work as an allowed iframe source:

https://docs.google.com/forms/d/e/1FAIpQLSfshJKrg_toMlnQtiUeBILwdiCTQhs54z7xHgzbRVuiQyJ6I/viewform

The full source from Google for the example above would be:

<iframe src="https://docs.google.com/forms/d/e/1FAIpQLSfshJKrg_toMlnQtiUeBILwdiCTQhs54z7xHgzbRVuiQyJ6I/viewform?embedded=true" width="760" height="500" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe>

4 个赞

我已经启用了此设置,但它仍然无法嵌入。

你把它放在 iframe 标签里了吗?

是的,我做到了。
你说的是允许的 iframe,对吗?

你好 AryaM :slight_smile:

以下是确保你正确配置各项设置的详细分步指南。

在你的 Discourse 设置中:

  1. 在你的 允许的 iframe 设置中添加 https://docs.google.com

从 Google 表单:

  1. 点击 发送

  2. 点击 <(iframe)按钮:


    并复制 iframe 代码。

在 Discourse 中:

  1. 将 iframe 代码粘贴到帖子中:
4 个赞