LESSON 5: Getting Web Slice content from an RSS feed source
LESSON 5: Getting Web Slice content from an RSS feed source
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="https://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>https://localhost/webslice/webslice.html</link>
<description>Las Vegas, NV (89044) Weather</description>
<ttl>60</ttl>
<item>
<title>Las Vegas 70° F Sunny</title>
<link>https://localhost/webslice/webslice.html#weather</link>
<description>
<div id="weather" class="hslice"> <div class="entry-content">
<h3><span class="entry-title">Las Vegas</span>, NV (89044) Weather</h3>
<img src="images/sunny.png" id="image" style="padding:5px;float:left"
alt="Sunny" height="128" width="128" /> <div class="entry-title"
style="font-size:2.5em;margin-top:24px;font-weight:bold;">70° F</div> <p
class="entry-title" style="font-weight:bold;font-size:1.5em">Sunny</p>
<p><i>All fictional, of course!</i></p> <p>Current conditions as of 4:56 PM
</p> <p style="font-size:xx-small">Updated every <span class="ttl"
>60</span> minutes.</p> </div> <a rel="feedurl"
href="https://localhost/weather.xml"></a></div>
</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