How to Embed Your Scratch Applet in HTML5
Even though there is a Scratch project website where the Scratch community uploads its projects, there is also an alternative method to embed Scratch within your own website. Since TeachMeProgramming.com is also teaching HTML5, we are happy to show you how to embed your Scratch applet using HTML5. Read on to find out more.
Pre HTML5 versions support the <applet> tag, however, this tag is deprecated in HTML5. HTML5 encourages the use of the <object> tag instead, which is brand new, that can be used to embed media in your website, such as videos and audio.
You will need 2 files in addition to your Scratch projects in the same directory as your HTML5 file:
The following code is used to embed a sample applet:
In the code above, the name of the Scratch project is "abc-song.sb" and is assigned to the attribute "value". The applet's dimensions (height and width) are configurable.
You can view the sample HTML5 by clicking on the image.
Enjoy!
Related Articles
- Teach Me Scratch for Kids (Intro)
- Teach Me Scratch - Creating Your Own Animation Using Costumes (Video 4)
- Teach Me Scratch - Making Your Sprite Move (Video 1)
- Teach Me Scratch - Adding Effects to Your Sprite (Video 2)
- Teach Me Scratch - Create a Comic Strip (Video 3)
- Teach Me Scratch - X & Y Coordinates and Pen Down Effect (Video 5)
- Teach Me Scratch - Sensing Feature/Hide and Show (Video 6)
- Teach Me Scratch - Broadcasting and Receiving (Video 7)
- Teach Me Scratch - Variables and Keeping Score (Video 8)
- Teach Me Scratch - Putting It All Together (Video 9)
- Teach Me Scratch - Edit Your Sprite (Video 10)
- Can Children learn HTML?
- HTML5 , Videos and OGG
- How to Embed Your Scratch Applet in HTML5
- Teach Me Java for Scratch Graduates
- Scratch Day 2010 in Rehovot, Israel
- Can Children learn HTML?
- HTML5 , Videos and OGG
Advertisements
Comments
The source code can be viewed in this file.
http://teachmeprogramming.com/media/html5applet.html
Until we find out why it isn't working, we can rely on the old embed version that can be found here.
http://www.passyworld.com/passyPDFs/HowToEmbedScratch.pdf
In one night (albeit a very long night) I made my first animation and uploaded it to a website! AMaZinG
Great instructions! Thanks for this code snippet!
RSS feed for comments to this post.