Contents Index Topic Contents | ||
Previous Topic: Using Dynamic HTML with Active Channels Next Topic: Creating Active Desktop Items |
Netcaster CDF Compatibility Notes
Due to the similarities between HTML and the Channel Definition Format, other browsers might be able to perform site crawling on a CDF file. This section describes the CDF file compatibility issues related to the release of Netscape Netcaster. For more information about CDF files and the implementation of this standard, see Microsoft's Webcasting White Paper.
Site Crawling a CDF File
Site crawling is the process of a browser proceeding through the following steps:
- Retrieve an HTML page.
- Store that page locally on a user's computer.
- Find the links (anchors) in the HTML page.
- Repeat this process from step 1 for each link (anchor) to an HTML page.
- Stop the above process when the browser has run out of links to follow or when the process has repeated enough times based on some criteria.
- Retrieve the actual content for each link to a non-HTML document, such as an image file or a text file.
Netcaster can use CDF files only toward site crawling and not for full CDF processing. For this to happen, Netcaster must use a CDF file as though it is an HTML page. The key to a browser site crawling CDF files lies in the anchor (A) element, which defines links in HTML.
<A HREF="http://www.microsoft.com/">Visit Microsoft!</A>This element identifies links for browsers to follow when site crawling. The anchor element can be found inside ITEM and CHANNEL elements of a CDF file. The HREF attributes of these anchor (A) elements identify which HTML pages are displayed when items and channels are selected.
<CHANNEL> <A HREF="http://www.microsoft.com/cover.htm"></A> <ITEM> <A HREF="http://www.microsoft.com/page1.htm"></A> <TITLE>Page 1</TITLE> </ITEM> </CHANNEL>When a browser uses the above CDF section as an HTML page for site crawling, it identifies the links "http://www.microsoft.com/cover.htm" and "http://www.microsoft.com/page1.htm". How the remaining content of the CDF file is used by the browser is less important. Some of it will be rendered, while most of it is ignored. In the majority of circumstances, a CDF file will never be displayed as HTML; it will simply be used for site crawling.
It is important to note that because Netcaster does not take advantage of the BASE attribute in a CDF file, relative URLs will be resolved by Netcaster against the base URL of the CDF file itself rather than the BASE attribute. For this reason, it is suggested that when authoring a CDF file for both Netcaster and Internet Explorer, either omit BASE attributes or make sure their value is the base URL of the CDF file itself. For example, if the CDF http://msn.com/channels/channel2.cdf has any BASE attributes, they should have the value "http://msn.com/channels/".
MIME Types and Extensions
For Netcaster to use a CDF file toward site crawling, it must process the file as an HTML file. To process the CDF file as HTML, one of the following three criteria must be met:
- A copy of the original CDF file must have the extension "htm" or "html".
- The HTTP server providing the CDF files must return the MIME (content) type "text/html" to browsers without full CDF support, and "application/x-cdf" to clients with full CDF support.
- The browser site crawling the CDF files must have the extension or MIME type of CDF files, "cdf" and "application/x-cdf", configured to be opened as HTML by the browser itself.
After one of these criteria has been met, a Netcaster user can subscribe to a channel defined by a CDF file. The user simply proceeds in the usual manner when subscribing to any Web page, except entering the URL of the CDF file.
Netcaster CDF Site Subscriptions
In Netcaster, when a user subscribes to a channel by specifying the URL of a CDF file created through the mentioned methods, the initial page for the channel will not be a normal HTML page. Instead, it will be a CDF file rendered as an HTML page and will probably not appear as desired. To remedy this situation, a channel author can create an intermediate HTML page to represent the channel content along with a reference to the CDF file. This can be achieved using Netscape's LAYER tag. A hidden LAYER tag referencing the new CDF file is inserted into the desired initial HTML as follows:
<LAYER SRC="cdf_file.htm" VISIBILITY=HIDDEN></LAYER>With this additional work, a user can use the URL of the intermediate HTML page rather than the URL to the CDF file when subscribing to a channel in Netcaster. To enable Netcaster to automatically subscribe to a CDF channel, script can be inserted into the intermediate HTML page as specified in Netscape documentation. This would allow a CDF channel to be subscribed to when a user clicks a button on the intermediate HTML page. The following examples show a CDF file and an intermediate HTML page that could be used with Netcaster.
A CDF file named "cdf_file.cdf":
<?XML VERSION="1.0"?> <CHANNEL HREF="http://msn.com/default.htm"> <ABSTRACT>This channel was created using the proposed CDF standard.</ABSTRACT> <LOGO HREF="http://msn.com/logo.gif" STYLE="IMAGE" > <SCHEDULE> <INTERVALTIME DAY="1" /> </SCHEDULE> <!-- the following items are needed for offline use --> <ITEM> <A HREF="http://msn.com/page1.html"></A> </ITEM> <ITEM> <A HREF="http://msn.com/page2.html"></A> </ITEM> <ITEM> <A HREF="http://msn.com/page3.html"></A> </ITEM> </CHANNEL>An intermediate Netcaster-compatible HTML page named "channel.htm" is provided below. This page references a copy, named "cdf_file.htm", of the above CDF file.
<HTML> <BODY> <LAYER SRC="cdf_file.htm" VISIBILITY=HIDDEN></LAYER> <SCRIPT language="JavaScript1.2" > var nc = components["netcaster"]; nc.activate(); var chan = nc.GetChannelObject(); chan.url = "http://msn.com/channel.htm"; chan.name = "My Channel"; chan.desc = "This Channel was created using JavaScript API extensions"; chan.cardURL = "http://msn.com/logo.gif"; function openDialog() { nc.AddChannelObject(chan); } </SCRIPT> </BODY> </HTML>
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.