Полезная информация

Special Edition Using HTML 4

Previous chapterNext chapterContents

- 31 -
Supporting the Active Desktop

by Jerry Honeycutt

Understanding the User's Desktop

With Internet Explorer 4.0, the user's desktop becomes a primary means by which he organizes Internet-related information:

In the middle of all this is Active Desktop content in the form of Active Desktop Components. Desktop content is brief and concise, offering headlines or summaries that lead to stories on your channel. Desktop content is the first thing the user sees when he logs on to the computer. Upon seeing an interesting summary, the user clicks it and is presented with the entire story in Internet Explorer 4.0.

The user organizes Active Desktop content right along with his Internet shortcuts, Favorites menu, and so on. Figure 31.1 shows you an example of desktop content, which contains headlines for Microsoft's Site Builder Network. When the user clicks one of the links, Internet Explorer 4.0 opens the related channel content in the browser.

FIG. 31.1
You can suggest a size for a desktop item, but the user can move and stretch it anyway he likes.

Desktop content is a perfect complement for channel content. You develop both of them using the same technologies, CDF and Dynamic HTML. Through careful design, you make your channel content more approachable, which draws more repeat visitors to it. Think of desktop content as the teaser that draws the user to your channel.

Examples of Active Desktop Content

The possibilities for desktop content are endless, and I hope the following list will inspire you with some ideas of your own:

What You Need to Know

Building content for the Active Desktop is not dissimilar to building Active Channel content. You specify the content of your content and schedule updates using a CDF file, as you learned in Chapter 30, "Building Channels with CDF." There are a few things you should know specifically about Active Desktop content, however:

Designing for the Active Desktop

Creating an HTML file for the Active Desktop is a bit unique. You're accustomed to building Web pages that display in a medium-size browser window and whose contents were potentially complex. Forget what you've learned; you must keep it simple. You can't go wrong if you follow these tips, though:

NOTE: By default, Internet Explorer 4.0 arranges the desktop into a 3x2 grid. When it adds an item to the desktop, it finds an empty cell in which to add it. Thus, make sure you keep your items below 214x220. Doing so ensures that your desktop item won't overlap with any other item when Internet Explorer 4.0 adds it to the desktop.

Examining How the Active Desktop Works

The Active Desktop is a container that can host any HTML object, such as HTML files, ActiveX controls, images, and so on. With Internet Explorer 4.0, the desktop is actually two different layers:

Building an Active Desktop Item

Building an item for the Active Desktop is little different from building a channel (see Chapter 30, "Building Channels with CDF"). You build a single HTML file as shown in Listing 31.1. Note that the content is lean, providing links to the primary Web site in a compact space. It uses Dynamic HTML to highlight links as the user rolls the mouse pointer over them.

Listing 31.1  HTML for Sample Active Desktop Item

<title>Sample Desktop Content</title>
<style type="text/css">
  <H1>    {font-family: sans-serif; font-size: 14}
  .normal { color: blue; font-family: sans-serif; font-size: 12;
            font-weight: bold}
  .hilite { color: red; font-family: sans-serif; font-size: 12; 
            font-weight: bold}
<script language="VBSCRIPT">
  Sub MouseOver()
    If window.event.srcElement.tagName = "A" Then
      window.event.srcElement.className = "hilite"
    End If
  End Sub
  Sub MouseOut()
    If window.event.srcElement.tagName = "A" Then
      window.event.srcElement.className = "normal"
    End If
  End Sub
<H1 align=right>Links to Jerry's Home Page:</H1>
<div style="border: 1px solid black" align=right 
     onmouseover="call MouseOver()" onmouseout="call MouseOut()">
<p><A href="http://rampages.onramp.net\~jerry" class="normal">
       Home Page
  <p><A http://rampages.onramp.net\~jerry\books.htm" class="normal">
       List of Books
  <p><A http://rampages.onramp.net\~jerry\bio.htm" class="normal">
       Biographyand Resume
  <p><A http://rampages.onramp.net\~jerry\essays.htm" class="normal">
       Index of Essays

The next step is to build a CDF file for the Active Desktop item. Your CDF file should be very simple, as shown in Listing 31.2. Note that the HREF attribute in the <CHANNEL> tag points to the same Web page as the HREF attribute in the <ITEM> tag. The schedule I've set for this desktop item is every seven days because that's approximately how often I want to update my Web site and tell the user about recent changes.

The most important thing to note about the CDF file in Listing 31.2 is the <USAGE> tag under the <ITEM>. You see VALUE set to DesktopComponent, which tells the browser to install HTML file as an item on the user's desktop. You can also assign ScreenSaver to this attribute and Internet Explorer will install your content as a screen saver on the user's computer. The <WIDTH> and <HEIGHT> child tags give the browser a suggestion for the size of the item.

Listing 31.2  Sample CDF File for an Active Desktop Item

<?XML version="1.0"?>
<!DOCTYPE Channel SYSTEM "http://www.w3c.org/Channel.dtd">
<Channel HREF="http://rampages.onramp.net/~jerry/desktop.htm">
    <IntervalTime DAY="7" />
  <Item HREF=" http://rampages.onramp.net/~jerry/desktop.htm ">
    <Title>Jerry Honeycutt's Home Page</Title>
    <Usage VALUE="DesktopComponent">
      <Width VALUE="120" />
      <Height VALUE="80" />

TIP: You must upload both files to a Web server in order to experiment with them. Internet Explorer 4.0 does not correctly parse CDF files that are on your local disk.

Figure 31.2 shows you the result. In this case, the user subscribed to the CDF file contained in Listing 31.2, and Internet Explorer 4.0 put the content contained in Listing 31.1 on the desktop.

FIG. 31.2
This Active Desktop item uses little of the user's desktop real estate and makes it possible to announce new features on the Web site as they become available.

Previous chapterNext chapterContents

© Copyright, Macmillan Computer Publishing. All rights reserved.