|This article or section documents a feature not included in the current version of Scratch (2.0). It is only useful from a historical perspective.|
- This article or section documents an outdated version of Scratch (version 1.4). For this article in Scratch 2.0, see Eng:Embedding Projects (2.0).
How to Embed Projects
There are four different ways of embedding a project onto a web page. Under the Project Notes and tags of a project, there is a section entitled "Link to this Project." If one clicks on "Embed", they are given the option copy and paste coding for web pages.
As an Image
This method inserts the image of a project, and links to the project, but does not actually let one play the project. It can be done by inserting the code that says "as an image."
As a Java Applet
This is the more useful method, and works most of the time. It allows the project to be played in the page, rather than just linking to it. It can be done by inserting the code that says "as an applet."
The code at the end which is
<a href="...">Learn more about this project</a>
can be removed, so that the link at the bottom does not appear. Alternatively, you can change the text and/or the link.
As a Flash Player
Embedding the Flash Player can be done by performing the following:
Copy and paste this into the code editor:
<object width="483" height="387" type="application/x-shockwave-flash" data="http://scratch.mit.edu/static/misc/PlayerOnly.swf"> <param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"> <param name="flashvars" value="project=http://scratch.mit.edu/static/projects/[USERNAME]/[PROJECT_ID].sb?version=[VERSION OF PROJECT]"> </object>
|Note:||You can also view the HTML page source of the project's page on the Scratch Website and extract the code directly.|
[USERNAME] with the username of the project creator,
[PROJECT_ID] with the id of the project, found in the URL after the username, and
[VERSION OF PROJECT] with the version of the project wishing to be played.
|Note:||The project version is a number which is changed by 1 every time you overwrite a project (when you upload a project with the same name as one you already have, you overwrite it).|
|Note:||If you want to embed a project hosted on your website then you need to host the Flash applet on your site as well or it will give you a security error.|