How to Embed Your Scratch Applet in HTML5

Scratch 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:

  1. ScratchApplet.jar
  2. soundbank.gm

The following code is used to embed a sample applet:

How to embed applet in HTML5

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!

Advertisements

Who's Online

We have 4 guests online

Website Grader

Advertisements

Visitors


Visits today:61
Visits yesterday:68
Visits in this month:251
Visits total:28240
Impressions today:286
Impressions total:165450
Bots today:93
Date since:2009-10-18

Countries

Top 7:
Unknown flag 32%Unknown (9079)
United States flag 26%United States (7387)
United Kingdom flag 9%United Kingdom (2507)
Israel flag 4%Israel (1098)
Germany flag 3%Germany (838)
India flag 3%India (830)
Netherlands flag 2%Netherlands (476)
28247 visits from 138 countries

Welcome, Visitors!