Skip to content

Embedding

GarboMuffin edited this page Jul 3, 2021 · 52 revisions

Embedding TurboWarp is very similar to how you embed Scratch 3:

<iframe src="https://turbowarp.org/414716080/embed" width="499" height="416" allowtransparency="true" frameborder="0" scrolling="no" allowfullscreen></iframe>

Replace 414716080 with the ID of your project. The dimensions above of 499x416 will result in the stage itself being rendered without distortion at the default stage size (480x360), but you can change it to anything and the player will automatically resize to fit.

URL parameters

All standard URL Parameters are still available, along with some special values exclusive to embeds:

Autoplay

Embeds also support the autoplay parameter, which will automatically hit the green flag when the project is loaded. For example: https://turbowarp.org/15832807/embed?autoplay

Note that audio may not work until the user interacts with the project (for example, clicking). This is a restriction imposed by browsers. There is nothing TurboWarp can do to work around this.

Usernames and cloud variables

By default the embed will generate a random username each time it loads. You can use the username URL parameter to override this behavior, for example: https://turbowarp.org/443603478/embed?username=1234

If you don't need cloud variables, consider setting the username parameter to an empty value to potentially reduce load on our server, for example: https://turbowarp.org/443603478/embed?username

Security considerations

If you use user-supplied information to generate embed links, please make sure to use encodeURIComponent or other sanitization to make sure that users cannot specify arbitrary parameters, as some parameters can cause remote code execution or other unexpected behaviors.

License

TurboWarp is licensed under the GPLv3.0. An <iframe> of a GPLv3.0 work probably doesn't create a derivative work under the GPLv3.0, but I am not a lawyer. Talk to a real lawyer if this is a concern.

Need more control?

Try the TurboWarp Packager.

Clone this wiki locally