Codetoy allows you to embed interactive multiplayer game development playgrounds directly into your website or documentation. This guide explains how to embed any Codetoy project directly into your own website.
The Codetoy embedding feature lets you:
To embed a Codetoy playground use the following url pattern {projectId}.project.codetoy.io/?embedded=true
<iframe
allowfullscreen
src="https://7a004431-3ffc-4e64-b5e4-fe46a9bcf241.project.codetoy.io/?embedded=true"
class="w-full h-[535px]"
></iframe>
Which yields the following:
When ?autofocus is set to true
the canvas will automatically become focused when the iframe loads.
This autofocus feature can be particularly useful in several scenarios:
Interactive Canvas Applications
User Experience Improvements
Example URL:
// Example URL usage
https://{projectId}.project.codetoy.io/?autofocus=true
However, be cautious with autofocus because:
Best practice is to use autofocus when:
When ?embedded is set to true
, renders the editor in embedded mode, which provides a minimal interface suitable for embedding in other websites or applications.
Warning: The ?embedded parameter is temporary and will be removed soon.