# Iframe issue without URL

**URL:** https://meta.discourse.org/t/iframe-issue-without-url/115512
**Category:** Support
**Created:** [4월 20, 2019, 2:01오전 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512 "2019-04-20T02:01:45Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![waffleslop](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waffleslop/32/244974_2.png) [@waffleslop](https://meta.discourse.org/u/waffleslop)
#### Post date: [4월 20, 2019, 2:01오전 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/1 "2019-04-20T02:01:45Z")

</div>

I would like a video to display on a Discourse Topic based on the following embed code. Note that I **have** whitelisted the iframe domain in Settings: ([https://cmox.cdn.vooplayer.com/](https://cmox.cdn.vooplayer.com/)).

`<script src="https://cmox.cdn.vooplayer.com/assets/vooplayer.js"></script><iframe allow="autoplay" class="video-player-container vooplayer" data-playerId="MTM3ODA1" allowtransparency="true" style="max-width:100%" name="vooplayerframe" allowfullscreen="true" src="" watch-type="" url-params="" frameborder="0" scrolling="no"> </iframe>`

Despite whitelisting, the iframe isn’t working. I believe that is because the URL is inside a `<script>` tag.

Any ideas on what I can try to get this video player to work?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [4월 20, 2019, 2:05오전 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/2 "2019-04-20T02:05:52Z")

</div>

You did not whitelist `<script>`, you only whitelisted `<iframe>` so I would not expect this to work..

---

<div class="post-metadata">

### Author: ![waffleslop](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waffleslop/32/244974_2.png) [@waffleslop](https://meta.discourse.org/u/waffleslop)
#### Post date: [4월 20, 2019, 2:08오전 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/3 "2019-04-20T02:08:20Z")

</div>

Yeah, that makes sense. Can I whitelist the script tag somehow?

I added the script tag into Admin \> Customize, then in the Header for the Light theme (the default).

The video is still not displaying.

What am I missing?

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [4월 20, 2019, 12:54오후 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/4 "2019-04-20T12:54:35Z")

</div>

> [@waffleslop](#):
>
> What am I missing?

Since the script you’re adding

```plaintext
<script src="https://cmox.cdn.vooplayer.com/assets/vooplayer.js"></script>

```

is considered third-party, you would need to whitelist it. You can do that by adding

```plaintext
https://cmox.cdn.vooplayer.com/assets/vooplayer.js

```

to the `content_security_policy_script_src` site setting in the admin like so

 ![whitelist](https://global.discourse-cdn.com/meta/original/3X/6/6/660c1ef8a5b5fea01604cb49bf7ce535553473e9.png)

If you’d like to learn more about Content Security Policy and how it affects Discourse customizations, please have a look [here](https://meta.discourse.org/t/mitigate-xss-attacks-with-content-security-policy/104243)

Also note that the `src` attribute in your Iframe code is empty so it doesn’t really load anything. Make sure the `src` attribute is set to the `src` of the Iframe you’re trying to load.

---

<div class="post-metadata">

### Author: ![waffleslop](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waffleslop/32/244974_2.png) [@waffleslop](https://meta.discourse.org/u/waffleslop)
#### Post date: [4월 20, 2019, 3:41오후 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/5 "2019-04-20T15:41:13Z")

</div>

Joe, I should have been able to find this answer without bugging y’all. Is there a bigger document on how to use Discourse that I can check in the future? Otherwise, I’m just searching Meta. And with all the great how-tos I’ve seen, I bet the Discourse team has built a bigger doc.

Can you point me in the right direction?

Also, I’m super grateful for all y’all do. Meta is such a killer community and the codebase seems so solid.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [4월 20, 2019, 9:04오후 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/6 "2019-04-20T21:04:36Z")

</div>

One downside here, you have made this script a dependency for your entire site, so every page downloads that extra script now.

---

<div class="post-metadata">

### Author: ![waffleslop](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waffleslop/32/244974_2.png) [@waffleslop](https://meta.discourse.org/u/waffleslop)
#### Post date: [5월 6, 2019, 12:46오전 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/7 "2019-05-06T00:46:00Z")

</div>

Still having issues.

I’m unable to get this script to display on my Discourse site:

`<script src="https://cmox.cdn.vooplayer.com/assets/vooplayer.js"></script><iframe allow="autoplay" class="video-player-container vooplayer" data-playerId="MTU1NTMy" allowtransparency="true" style="max-width:100%" name="vooplayerframe" allowfullscreen="true" src="https://cmox.cdn.vooplayer.com/publish/MTU1NTMy" frameborder="0" scrolling="no"> </iframe>`

I have allowed the Script and iFrame:

 ![image](https://global.discourse-cdn.com/meta/original/3X/d/e/deca1dc5e73a70281fab745b46c27139360a8b69.png) ![image](https://global.discourse-cdn.com/meta/original/3X/1/2/1231e92e4bfc558a74183aabe9c512d2830ba378.png)

I put together a simple plugin and installed it:  
[https://github.com/waffleslop/discourse-vooplayer](https://github.com/waffleslop/discourse-vooplayer)

The code I have is as follows:  
`Discourse.Markdown.whiteListTag("div", "style", /[a-z]+/); Discourse.Markdown.whiteListTag("div", "class", /[a-z]+/); Discourse.Markdown.whiteListTag("iframe", "class", /[a-z]+/); Discourse.Markdown.whiteListTag("iframe", "style", /[a-z]+/);`

However when I try to embed the video, this is what happens:

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/b/fb2d80361ffa0810d7d79d0d04e1f08e64822669.png)

It looks like Discourse is stripping `style` and `class` from the embed.

Similarly, I am finding this:  
`<div class="123">test</div>`  
to be displayed as:  
`<div>test</div>`

It looks like Discourse is stripping all class/style, even from simple divs.

What can I do to get this to work?

Thank you!

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [5월 6, 2019, 5:04오전 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/8 "2019-05-06T05:04:12Z")

</div>

> [@waffleslop](#):
>
> The code I have is as follows:  
> `Discourse.Markdown.whiteListTag("div", "style", /[a-z]+/); Discourse.Markdown.whiteListTag("div", "class", /[a-z]+/); Discourse.Markdown.whiteListTag("iframe", "class", /[a-z]+/); Discourse.Markdown.whiteListTag("iframe", "style", /[a-z]+/);`

This is a big no no. By adding this you’re removing some of the very important abuse prevention measures that Discourse has. We strip these things for a reason.

Long story short, I’ve looked at vooplayer embeds and you’re in for a bit of work. There’s going to be a lot of friction because the way vooplayer handles their iframes is not ideal in the context of a single page application.

I would strongly recommend that you use another service like Youtube or Vimeo if you can as these are supported out of the box in Discourse.

If you’re set on using vooplayer, then the scope of the help you need exceeds what we can provide and I would recommend a topic in the #Marketplace category.

---

<div class="post-metadata">

### Author: ![waffleslop](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/waffleslop/32/244974_2.png) [@waffleslop](https://meta.discourse.org/u/waffleslop)
#### Post date: [5월 6, 2019, 2:58오후 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/9 "2019-05-06T14:58:09Z")

</div>

Thanks for spending time and reviewing the iFrame, Joe. I appreciate that!

Vooplayer has this “fallback” code I can use as well. Is it possible to get this to work simply?

`<div style="position:relative; width:1px; min-width:100%; padding-bottom:56.25%"><iframe allow="autoplay" class="vooplayer" allowtransparency="true" style="width:1px; min-width:100%; height: 100%; position:absolute" allowfullscreen="true" src="https://cmox.cdn.vooplayer.com/publish/MTU1NTMy?fallback=true" frameborder="0" scrolling="no"> </iframe></div>`

If not, I’ll take your direction to use Vimeo.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [5월 6, 2019, 4:38오후 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/10 "2019-05-06T16:38:12Z")

</div>

Yes, that embed should just work with the iframe embed whitelist. You can drop the `<div ....>` and `</div>`.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [6월 5, 2019, 4:47오후 UTC](https://meta.discourse.org/t/iframe-issue-without-url/115512/11 "2019-06-05T16:47:27Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
