Hosting your own Scratch web player
I made an entry for LD #26 in Scratch and used their website to host the file and the player. It’s a convenient system but unfortunately subject to the whims of their update schedule. For the next few days I’m expecting the Scratch web site to be down as they upgrade to Scratch 2.0.
So I thought I’d post up a quick guide on hosting the Scratch player (the Java player at any rate) on your own web site. Assuming you have a web site capable of serving up your files you’ll need 3 things to make it work:
- your Scratch .sb binary file
- the ScratchApplet.jar file
- a web page to hold your content
Your Scratch binary file is the file that you save out from the Scratch environment when you save locally on your own machine. The Scratch applet you can get from the Scratch web site. I grabbed a copy and put it in my Dropbox if anyone needs it:
https://dl.dropboxusercontent.com/u/15225572/ScratchApplet.jar
As for the web page, you’ll need to write that yourself. The most likely thing to go wrong when putting this all together is paths and the folder structure. Here’s the structure I chose:
public_html/Projects/MyWebPage.html
public_html/java/ScratchApplet.jar
public_html/scratch/MyScratchFile.sb
You could use a different structure, but beware that this will mean you need to put different paths into your embed code to make it work. Here is a bare web page template that should work and you can modify to host your own Scratch files:
<html> <head> <title>My Scratch Project</title> </head> <body> <h1>My Scratch Project</h1> <div> <applet id='ProjectApplet' style='display:block' code='ScratchApplet' codebase='../java' archive='ScratchApplet.jar' height='387' width='482'> <param name='project' value='../scratch/MyScratchFile.sb'> </applet> </div> </body> </html>