Permalink
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (56 sloc) 2.91 KB
layout title date categories tags x-source x-comments x-comment-url
post
Embed a Scratch applet in HTML5
2010-05-22 18:19:00 -0700
applet drum embed HTML5 java scratch
1

For the past year I've been following the progress of HTML5 with interest. And recently I've become interested in MIT's Scratch. So naturally I've been test embedding Scratch using it's Java applet in HTML5. The only article I've found so far on embedding Scratch in HTML5 contains a number of errors and invalid markup, so I'm setting the record straight.

First, the situation in HTML 4.01/XHTML 1.0 – <object> is the preferred element, with <applet> deprecated. So, <applet> is valid in HTML 4 Loose (XHTML 1.0 Transitional), but not HTML 4 Strict.

Drum Kit 2.0, by technoguy

Example embed for HTML 4.01:

{% highlight html %}

Your browser needs Java to view projects. {% endhighlight %}

In HTML5, the <applet> element is obsolete, not deprecated. So, we use the generic <object> element. Also, we need an alternative to the archive, code and codebase attributes. It took me a while to work out the solution, with the help of the W3C validator – we can use the <param> element.

Now, the HTML5 code:

{% highlight html %}

Your browser needs Java to view projects. ... {% endhighlight %}

Drum Kit 2.0, by technoguy.

Your browser needs Java enabled to view projects.