This is modified from TurboWarp
Embedding
Snail IDE can be embedded with a standard iframe:
<iframe src="https://editor.snail-ide.com/embed/#414716080/" width="499" height="416" allowtransparency="true" frameborder="0" scrolling="no" allowfullscreen></iframe>
Replace 414716080
with the ID of your project. You can change the width and height of the iframe and the player will automatically resize to fit (499x416 will result in the stage rendering at an undistorted 480x360).
Snail IDE's embeds will have a transparent background if the iframe is allowed to be transparent. Snail IDE's embeds will have a fullscreen button if the iframe is allowed to become fullscreen. The example code above enables both of these feature.
URL parameters
All standard URL Parameters are still available. You can use these to control usernames and other things.
There are also some special parameters only available in embeds:
Autoplay
Embeds support the autoplay
parameter, which will automatically hit the green flag when the project loads. For example: https://editor.snail-ide.com/embed?autoplay
Note that sound blocks may not work until the user interacts with the project (for example, by clicking). This is a restriction imposed by browsers. There is nothing TurboWarp can do to work around this.
Settings button
You can optionally enable a settings button in embeds with the settings-button
parameter that opens a similar menu to the "Advanced settings" menu found in the website and editor. For example: https://editor.snail-ide.com/embed#12345678?autoplay&settings-button
Fullscreen background color
Outside of fullscreen mode, the embed is transparent so you can style the parent element if you want to change the background color.
In fullscreen mode, the embed will either use a white or an almost black color depending on whether the user's computer is configured to dark mode or not.
To override this behavior, set the fullscreen-background
parameter to a CSS color value like black
or rgb(50,90,100)
. For example: https://editor.snail-ide.com/#15832807/embed?fullscreen-background=yellow
You can also use hex colors if you escape the #
with percent encoding: %23abc123
.
Addons
By default, embeds have no addons enabled. This can be overridden with the addons
parameter, which is a comma separated list of addon IDs to enable. For example: https://editor.snail-ide.com/embed#123456789?addons=pause,gamepad,mute-project
Useful addons and their IDs:
- "Pause button" is
pause
- "Muted project player mode" is
mute-project
- "Remove curved stage border" is
remove-curved-stage-border
- "File drag and drop" is
drag-drop
- "Gamepad support" is
gamepad
- "Reverse order of project controls" is
editor-buttons-reverse-order
- "Clone counter" is
clones
Other addons will have no effect on the embed.
Security considerations
If you use user-supplied information to generate embed links, you should sanitize any arguments to make sure users can't supply arbitrary URL parameters as some can lead to unexpected behaviors.
Need more control?
Use the TurboWarp Packager for more control over the loading screen, accent colors, controls, and more. You can also embed the output of the packager very easily.
License
Snail IDE is licensed under the GPLv3.0. We believe that an <iframe>
of a GPLv3.0 work doesn't create a derivative work under the GPLv3.0, rather it creates an "aggregate work" which is not subject to the same requirements as derivative works. However, we are not lawyers and this is not legal advice. Talk to a lawyer if this matters to you.