Scriptlets let programmers write code for a simple Web page element--a bar chart or scrolling list, for example--and reuse it across the pages of a site. A technique called "server-side include" (SSI) performs a similar function, but scriptlets have two advantages, according to Microsoft representatives.
First, they let the client download and cache the component for reuse. SSI forces a user to download repeating HTML code (such as the navigation bars on the side of this page) for each new page visited.
Second, the browser reads scriptlets separately from the main portion of HTML. Because the scriptlet hides much of its internal code from the browser, there's less chance of a conflict--and a resulting error message--between the scriptlet and another piece of code that might happen to have the same name. This "encapsulation" also makes it easier for designers to reuse scriptlets, Microsoft said.
Because scriptlets are IE 4-only, Web designers who add them to a page will have to use the HTML "object" tag to create an alternate element for users of Netscape Navigator, older versions of IE, and other browsers.
One designer thinks Dynamic HTML tools such as scriptlets could replace a lot of the simpler uses of Java, however. "So what if they aren't as powerful as Java?" said Glen Davis with the developer information site Project Cool. "Have you seen those Java ad banners that track the mouse and respond to users? You could easily do them as scriptlets."
Scriptlets are based on the Document Object Model (DOM), which is not yet an approved standard. The World Wide Web Consortium is currently working on the specification, which means any implementation of scriptlets now might need to be reworked in the future.
"We'll support whatever the standard ends up being," said Tom Johnston, Microsoft group product manager of platforms marketing. "Authors can wait for the [final W3C] recommendation and risk being a year behind, or if they're on the bleeding edge, they can go ahead and should be aware that some things may change."