Today the MIX Conference in Las Vegas opens its doors and there will be quite some interesting announcements there. I will surely blog about some of them and today I will take a start with the public release of Internet Explorer 8 and one of its new features. This is called Webslices & Activities and is as compelling as it is simple because it easily enables you to extend the IE Browser. Now you might say "piece of cake" can be done for years and not only with IE but with other browsers as well. Yes, that's correct however not entirely because it is not that easy. Well at least not as easy as it is now with Webslices & Activities. But before continuing with the prose let's shortly introduce you to:
<?xml version="1.0" encoding="UTF-8"?> <openServiceDescription xmlns="http://www.microsoft.com/schemas/openservicedescription/1.0"> <homepageUrl>http://dict.leo.org/</homepageUrl> <display> <name>Translate with Leo.org</name> <icon>http://dict.leo.org/favicon.ico</icon> </display> <activity category="Define"> <activityAction context="selection" > <preview action="http://pda.leo.org/ende?lp=ende&lang=de&searchLoc=0&search={selection}&relink=on"/> <execute action="http://dict.leo.org/ende"> <parameter name="search" value="{selection}" /> <parameter name="lp" value="ende" /> <parameter name="lang" value="de" /> <parameter name="searchLoc" value="0" /> <parameter name="cmpType" value="relaxed" /> <parameter name="sectHdr" value="on" /> <parameter name="spellToler" value="on" /> <parameter name="relink" value="on"/> </execute> </activityAction> </activity> </openServiceDescription> So you see the whole magic are two URLs which point to the remote service. The rendering of the response is entirely up to the activity's service provider. The Xml configuration can be provided by the service provider or anyone else. The activities engine only checks that the homepageUrl is from the same domain as the actionUrls. This means however that you need to be careful and only register activities from sites you trust. And finally in order to have IE8 recognize an activity configuration as such you need to provide a link with the href is pointing to a javascript function and so the url must look similar to this: href="javascript:window.external.addService('http://www.level70.de/ie/activities/LeoTransActivity.xml'). So here is how it looks like in action.
<div id="test" class="hslice" style='width: 280px; font-family: Segoe UI; text-align: center'> <div> <div class="entry-content"> <h3> <span class="entry-title">Seattle</span>, WA (98121) Weather </h3> <img src="images/cloudmoon.png" id="image" style='float: left' height='128' width='128' /> <div class="entry-title" style='float: none;margin-left:20px'> <p style='margin-top: 0px; margin-bottom: 0px; font-size: 26px; line-height: 32px;font-weight: bold;'>89<br />°F</p> <p style='margin-top: 0px; margin-bottom: 0px'>Drizzle</p> </div> <div> <p style='font-size: smaller'> <i>All fictional, of course!</i> </p> </div> </div> </div> <div> <abbr class="updated" title="2007-07-25T20:51:00-05:00" /> <p>Current conditions as of 10:35 AM</p> </div> </div>
I marked the important annotations with bold font. So you see that the annotations are encapsulated within class names of the respective HTML elements. So you can note that the container must be defined with a class name of "hslice", the title with the class name "entry-title" and the content with "entry-content". Needless to note that projected back on the screenshots shown earlier the "entry-title" is rendered as the slice button text and the hover text whereas the "entry-content" is rendered in the overlay window. If like in the sample the "entry-content" is enclosing the "entry-title" the title is as well part of the rendered view of the slice.
So that's it for a short introduction on Webslices and Activities coming with Internet Explorer 8. If you want to know more and want to dig deeper in the technical details you can go to the IE Developer Center and find everything you'll need.
If you want to try the activity sample I used in this post you can add it here.
And finally if you want to see how easy it is to have an Silverlight application in the preview window just check this out.