Setting up the script context, which I refer to as a "scriptbridge", is very easy (just view the source), though currently you have to use a couple of different methods to nail it down. Once the scriptbridge is established, you can call functions in the SVG scripting context from HTML, and vice versa. Through the HTML host document, you can even communicate between different instances of the same SVG document, as demonstrated in the example above. Here, the user can select a shape type and a target canvas (SVG instance) to insert the shape into, using an HTML form. Each instance receives the function call, and dynamically generates a random shape of the right type; if the same command is sent to both instances, each will still create a unique element with its own random characteristics. Clicking on any shape send that shape to the HTML scripting context, where the details of the shape are displayed, and the shape is can optionally be inserted into the other SVG document instance.