Export (0) Print
Expand All

LESSON 5: Getting Web Slice content from an RSS feed source

LESSON 5: Getting Web Slice content from an RSS feed source New for Windows Internet Explorer 8

This tutorial explains how to create an alternate feed source for a Web Slice.

This is the second of two options to control network load on your servers

Internet Explorer 8 revisits the page that hosts the Web Slice to get updated content. Although this makes it convenient to implement Web Slices, it is not the most efficient way to retrieve updates. You can optimize this operation by specifying that updates to the Web Slice should come from an alternate URL.

Example:

  • class="feedurl" — This class is used to indicate that an anchor tag points to an alternate feed URL.

<a rel="feedurl" href="http://localhost/webslice/weather.xml" style="display:none;"></a>

The alternate feed should contain just one item. If the feed contains more than one item, Internet Explorer will use only the first item. This is the feed format:


<rss version="2.0" >
<channel>
  <title>My Fictitious Schedule - Web Slices HOL</title>
  <link>http://localhost/webslice/webslice.html</link>
  <description>Las Vegas, NV (89044) Weather</description>
  <ttl>60</ttl>
  <item>
    <title>Las Vegas 70° F Sunny</title>
    <link>http://localhost/webslice/webslice.html#weather</link>
    <description>
      &lt;div id=&quot;weather&quot; class=&quot;hslice&quot;&gt; &lt;div class=&quot;entry-content&quot;&gt; 
      &lt;h3&gt;&lt;span class=&quot;entry-title&quot;&gt;Las Vegas&lt;/span&gt;, NV (89044) Weather&lt;/h3&gt; 
      &lt;img src=&quot;images/sunny.png&quot; id=&quot;image&quot; style=&quot;padding:5px;float:left&quot; 
      alt=&quot;Sunny&quot; height=&quot;128&quot; width=&quot;128&quot; /&gt; &lt;div class=&quot;entry-title&quot;
      style=&quot;font-size:2.5em;margin-top:24px;font-weight:bold;&quot;&gt;70° F&lt;/div&gt; &lt;p
      class=&quot;entry-title&quot; style=&quot;font-weight:bold;font-size:1.5em&quot;&gt;Sunny&lt;/p&gt; 
      &lt;p&gt;&lt;i&gt;All fictional, of course!&lt;/i&gt;&lt;/p&gt; &lt;p&gt;Current conditions as of 4:56 PM
      &lt;/p&gt; &lt;p style=&quot;font-size:xx-small&quot;&gt;Updated every &lt;span class=&quot;ttl&quot;
      &gt;60&lt;/span&gt; minutes.&lt;/p&gt; &lt;/div&gt; &lt;a rel=&quot;feedurl&quot;
      href=&quot;http://localhost/weather.xml&quot;&gt;&lt;/a&gt;&lt;/div&gt;
    </description>
  </item>
</channel>
</rss>

Exercise #5:

Add an alternate feed for the weather Web Slice. Use the weather.xml feed provided for you.

A few things to remember:

  • The HTML of the Web Slice preview is encoded as the body of the RSS feed item.
  • In an alternate feed, only inline styles can be used to modify the appearance of the Web Slice.
  • The link element is used to open the original page from the Web Slice preview window. The item link takes precedence over the channel link.
  • Time-to-live (TTL) is specified by the ttl channel element.

Quick Review

  • You can use an alternate feed to minimize bandwidth requirements of hosting a Web Slice.
  • Link to the alternate feed by creating an anchor tag with class="feedurl".

Check your work

  • When you refresh the Web Slice do you do you notice the change? If not, compare your work with Source Listing #5.

More Lessons

Go forward to LESSON 6: Using a custom button to install a Web Slice

Go back to LESSON 4: Setting a time-to-live (TTL) value

Related Topics

Community Additions

ADD
Show:
© 2014 Microsoft