Writing scriptlets is not a difficult task. It is easier, however, if you have the right tools and the right approach. First of all, you should think of scriptlets as normal Web pages hosted in another HTML document, which acts as a container. From this point of view, scriptlets can be considered as ordinary ActiveX controls and, therefore, handled in the same way.
As is explained later in the chapter, scriptlets and controls are inserted in Web pages via the same
tag. Some authoring tools—completely unaware of scriptlets—consider them pretty similar.<OBJECT>
Like ActiveX controls, scriptlets may have a user interface and can expose an automation interface. In this way they can be driven and forced to serve your own purposes. When designing the host page you assign the scriptlet a client site. At run-time—that is when you view the page through a browser—the area you specified becomes the surface from which the scriptlet will draw some output.
The scriptlet sees this client site as the traditional
object defined by the Internet Explorer 4.0 Scripting object model.window
In this chapter, we'll discuss scriptlet architecture and internal layout in detail. We will also discover how they are hosted and implemented by Internet Explorer 4.0. However, most of the chapter is devoted to understanding the scriptlet public interface—the key aspect that makes them so clean, elegant and generally pretty superb. More specifically, we'll aim to cover the following:
In doing so we present the first, straightforward example of a scriptlet and also take advantage of the chance to discuss hosting and automation. In the next chapter, we will see a more advanced sample together with an automatic tool able to produce skeleton scriptlets.