JSFiddle-Like embeds in posts

I’ve written to the discourse team to see if we can do something like the answer here in our discourse posts. Would be great to have jsfiddle-like functionality directly in the posts. What do you think?

1 Like

This would be great! I would suggest looking at the StackOverflow Code Layout. It’s even runnable through StackOverflow. Plus: StackOverflow Moderators could answer our question and help us if we ask on the Meta!

Test sketchfab:

Test codepen:

Hmmm. Does JSFiddle have an embed option? Because that is what we need here,

It isn’t an embed issue per se, more, if its embeds adhere to oEmbed or OpenGraph standards, which is what OneBox supports. OneBox is the system that allows one to paste a link and renders a preview. The codepen above is just the normal url, not any specific embed url, and the specific embed url might not work.

However, the JSFiddle embed may be just what you need…

We should try however!

I have, I failed…if you want to try, go for it! I hope you have better luck than I.

p.s. one well written post is better than several subsequent posts.

Are there such thing as non-discussion posts? I thought these were all like basically discussions!

Seems oneboxing jsfiddle might not be possible. We can use codepen.io for now.

@fraguada I think it would be useful to keep site discussion topics open at the moment, while we are going through the initial setup of the site. There’s not that many of them anyway.

Is it possible for us to install plugins? Having jsfiddle embeds would be really useful given that up until now pretty much all three.js examples use it, and it looks like creating a plugin would be straightforward (not to mention other useful plugins such as mathJax for writing LaTeX maths equations).

I found a link on discourse saying that plugins are only available on enterprise level hosted forums, however is it possible that they would provide this for open source projects too?

I’ll check about the possibilities of adding a plugin. I feel the more interesting way would be to check why jsfiddle links don’t work with onebox (the plugin responsible for adding the html based on the link). Maybe the jsfiddle people would enable such functionality?

1 Like

http://jsfiddle.net/zalun/NmudS/embedded/result,js,html,css/

…guess that doesn’t work either :slight_frown:

I’ve checked with the meta discourse to see where the best path forward. If you check iframely with the dev jsfiddle template, it seems the embed code would look great here!

1 Like

Yeah, I saw that - I wonder how much of an issue allowing js code to run actually is? I would have thought the worst you can do is crash the browser, probably just the tab in fact.

If you can use javascript, then you can steal other peoples account due to access to cookies and then send the cookies to another website. Or you could create a redirect to another phishing page.

Those are the 2 things I can come up with in seconds, so it is pretty unsafe to allow it.

Fair enough. But can’t you do the same with a codepen too? The only difference is that people will have to click a “run” button first.

Can we embed github gists? Testing…

https://gist.github.com/looeee/830cd4d930a637520293a81e6e55e9fb

EDIT: sweet!