IE8: Web Slices – Keep yourself updated!

Another amazing feature that IE 8 has pulled out of the hat is – the Web Slices. Today, a very common way of keeping the visitors updated about what's happening on your website is using the RSS. However, maintaining these feeds usually require the websites to duplicate the data access in multiple locations – on the page as well as on the RSS feeds.

With the IE 8 web slices feature, your web site customers can now subscribe to parts of the web page which they would want to get updated about. Areas within a particular webpage can be marked as a web slice by the web developers when creating the sites. Web Slice button on IE toolbar

These web slices can then be subscribed to by the web site visitors. Subscribing is as simple as clicking the green web slice button on the IE 8 toolbar when you visit the site. Once subscribed, that area can be accessible and visible through the Favorites menu. In other words you don't have to go to the website every time to see what's updated.

The possibilities are end-less – You might want to keep yourself updated about the new releases on the codeplex, or just get the latest news right in your browser window, or even watch out for the stock that you bought last week.

 

Web Slices for Web Developers

It is quite amazing how simple it is to build discoverable web slices for the web developers. The web slices is based on the hAtom.Microformat with a few additional properties. It uses the HTML tags with specific properties & classes to create a section of the web page that can be subscribed to. IE 8 detects the web slices by scanning for elements that use the class hSlice, have a unique id property and have at least one child using the class entry-title.

To try this out real quick – here is how you can develop your web page. Once you have your web page ready with content, determine which sections you need to expose as web slices. For those sections, simply wrap them in a div as –

    <div class="hslice" id="myWebSlice">

        <h2 class="entry-title">My Web Slice Title</h2>

            <!-- My dynamic content goes here à

    </div>

Whenever visitors visits this page in IE8, they will be able to subscribe to this web slice by clicking on the green web slice button in the IE8 toolbar. Alternatively, they can also hover over to content to get the web slice button right besides it.

The web slices offer a lot of flexibility in terms of controlling the update frequency or providing an alternative data source to update, etc. This article on MSDN covers the web slices in a good details.

Happy Browsing,

--Sanket