Providing interactive multimedia and graphical control within a web page has always been slightly problematic using traditional HTML. Over the years several proprietary technologies have been created to help designers bridge the gap between the visual, the interactive, and the programming world.
Offering high levels interactivity within a web page traditionally meant 1 of 2 paths had to be chosen:
Now, however, Microsoft has released Silverlight, which merges simple JavaScript, a new presentation layer definition language, and rich multimedia support, all within a single browser window. This article introduces the Microsoft Silverlight model, and then looks at some innovative possibilities for JavaScript and PHP programmers.
Silverlight is deployed through a web browser which has the Silverlight Plug-in installed. This is a free plugin which is available from the Microsoft Silverlight web page. From the client side, this is all that is required to use pages that are Silverlight enhanced.
On the server side, a Silverlight document consists of:
When the page is defined, the Silverlight object is embedded in much the same way as a Flash object, or similar. It's definition (what it will eventually display, or render) is contained within an XAML file. This file gives Silverlight specific XML definitions which allow the plug-in to render a 'scene'.
Interactivity is provided through specific functions in a JavaScript file. A second JavaScript file handles application (plug-in) start-up and other vital tasks.
Silverlight can handle images, video, sounds, and interaction with the user. Various applications are envisaged, including the ability to let the consumer feed information back to the server through the use of AJAX alongside Silverlight. Silverlight also offers a shape rendering (drawing) API of it's own.
Since Silverlight deployment is based around JavaScript and XML, it is logical to extend the use of Silverlight to co-exist with AJAX. AJAX, the reader will remember, is a way of providing communication from web page to server asynchronously in the background.
Using Silverlight, we can allow the user to perform actions which lead to modification of the Silverlight object in the web page. This extends to being able to dynamically create and destroy artifacts created during the object's life cycle. In addition, if we allow AJAX (through JavaScript) to interact with the server (via PHP) we can also produce a dynamic Silverlight embedded object that can be updated through communication with the server, and also update data on the server as the consumer interacts.
For web programmers all over the world, this opportunity presents some very exciting possibilities.
Right now, Silverlight is very much a Microsoft platform. It is only officially currently available for Internet Explorer running on Microsoft Windows or Macintosh operating systems. However, work is afoot with the Moonlight project (a partnership between Novell and Microsoft) to deliver Silverlight on Linux platforms. As the story unfolds, expect this PS to be updated accordingly.
For more information on these topics, read Beginning AJAX and Web XML.