# Jsfiddle-like embeds?

**URL:** https://meta.discourse.org/t/jsfiddle-like-embeds/59215
**Category:** Feature
**Created:** [March 15, 2017, 11:01pm UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215 "2017-03-15T23:01:21Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Luis\_Fraguada](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/luis_fraguada/32/121151_2.png) [@Luis\_Fraguada](https://meta.discourse.org/u/Luis_Fraguada)
#### Post date: [March 15, 2017, 11:01pm UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215/1 "2017-03-15T23:01:21Z")

</div>

Hello! Just getting started with our community at [https://discourse.threejs.org](https://discourse.threejs.org)! I wanted to know the right tool to enable us to embed jsfiddles or similar into posts? What I’d essentially like to do is something like is shown in the answer to [this stackoverflow](http://stackoverflow.com/questions/42701493/three-js-fast-text-engraving/42730002) question. Here, a working solution is offered right in the post. Is something like this possible?

 ![](https://global.discourse-cdn.com/meta/original/3X/5/0/5026b6a197214f4680aba9fb4969f56c8f44ecbe.png)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 16, 2017, 12:22am UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215/2 "2017-03-16T00:22:30Z")

</div>

You can use CodePen:

https://codepen.io/Yakudoo/embed/preview/YXxmYR?default-tabs=js%2Cresult&height=300&host=https%3A%2F%2Fcodepen.io&slug-hash=YXxmYR

Also sketchfab for viewving 3D models:

https://sketchfab.com/models/e55d0654db1242fa906b7b0ad66fc539/embed?

---

<div class="post-metadata">

### Author: ![Luis\_Fraguada](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/luis_fraguada/32/121151_2.png) [@Luis\_Fraguada](https://meta.discourse.org/u/Luis_Fraguada)
#### Post date: [March 16, 2017, 12:27am UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215/3 "2017-03-16T00:27:27Z")

</div>

Great! Will test those out!

---

<div class="post-metadata">

### Author: ![Luis\_Fraguada](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/luis_fraguada/32/121151_2.png) [@Luis\_Fraguada](https://meta.discourse.org/u/Luis_Fraguada)
#### Post date: [March 20, 2017, 8:33am UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215/4 "2017-03-20T08:33:21Z")

</div>

It is great to have codepen, but our community prefers jsfiddle as most of the examples and issues are tested there. jsfiddle does have embed code, and this is what [Edit fiddle - JSFiddle - Code Playground](http://jsfiddle.net/hw9rcLL8/) looks like in [iframely](http://iframely.com/debug?uri=http%3A%2F%2Fjsfiddle.net%2Fhw9rcLL8%2F).

Here is what the embed code looks like:  
`<iframe width="100%" height="300" src="//jsfiddle.net/hw9rcLL8/embedded/" allowfullscreen="allowfullscreen" frameborder="0"></iframe>`

What would be the way forward to support this on our discourse?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 20, 2017, 9:39am UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215/5 "2017-03-20T09:39:56Z")

</div>

Someone could make a custom onebox which turns a jsfiddle link into an embed… however any code in the fiddle is run as soon as the embed loads, which can be very risky. See here:

> [@Can we make custom oneboxes?](https://meta.discourse.org/t/can-we-make-custom-oneboxes/51463/3):
>
> The big thing that needs testing is that there is 0 JS execution prior to a user clicking “run”. We can not risk people setting up JavaScript bombs.

---

<div class="post-metadata">

### Author: ![Luis\_Fraguada](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/luis_fraguada/32/121151_2.png) [@Luis\_Fraguada](https://meta.discourse.org/u/Luis_Fraguada)
#### Post date: [March 20, 2017, 11:22am UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215/6 "2017-03-20T11:22:02Z")

</div>

Thanks for the reply.

> [@david](#):
>
> however any code in the fiddle is run as soon as the embed loads, which can be very risky

Isn’t it the same risk as running the [copdepen.io](http://copdepen.io) @Falco linked to above?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 20, 2017, 11:22am UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215/7 "2017-03-20T11:22:51Z")

</div>

> [@Luis\_Fraguada](#):
>
> Isn’t it the same risk as running the [copdepen.io](http://copdepen.io) @Falco linked to above?

Kind of, but the key thing is that the codepen embed is “click to run”, whearas jsfiddle just runs as soon as the page loads.

---

<div class="post-metadata">

### Author: ![Luis\_Fraguada](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/luis_fraguada/32/121151_2.png) [@Luis\_Fraguada](https://meta.discourse.org/u/Luis_Fraguada)
#### Post date: [March 20, 2017, 11:23am UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215/8 "2017-03-20T11:23:53Z")

</div>

Right, but could the custom onebox handle a similar case, where one would need to click a button to load the jsfiddle embed?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 20, 2017, 11:25am UTC](https://meta.discourse.org/t/jsfiddle-like-embeds/59215/9 "2017-03-20T11:25:35Z")

</div>

Yes, I guess it could wait for a user click before loading the iframe. Would require more development work but it should be possible.
