Hello! Just getting started with our community at 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 question. Here, a working solution is offered right in the post. Is something like this possible?
You can use CodePen:
Also sketchfab for viewving 3D models:
Great! Will test those out!
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 looks like in iframely.
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?
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:
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.
Right, but could the custom onebox handle a similar case, where one would need to click a button to load the jsfiddle embed?
Yes, I guess it could wait for a user click before loading the iframe. Would require more development work but it should be possible.