Share via


How to write a "Find on MSDN" Accelerator for Internet Explorer 8 (with working sample)

MSDN is one of the sites I use most frequently, so I thought it would be a good candidate for my first IE 8 Accelerator. And it turns out it's even easier to do than writing a webslice. All you need to do is write a simple XML file, the specification for which can be found here on MSDN.

The below is the content of my MSDNAccelerator.xml file and as you can see it's pretty simple. I'm reusing MSDN's favicon.ico as for my accelerator (note that the domain name used for the icon must match that of os:homepageUrl). The os:activityAction and os:execute elements define the interaction with your sevice provider -  in this case I just pass the selected text to the MSDN search engine via the os:execute block.

 

    1:  <?xml version="1.0" encoding="UTF-8"?>
    2:  <os:openServiceDescription
    3:      xmlns:os="https://www.microsoft.com/schemas/openservicedescription/1.0">
    4:    <os:homepageUrl>https://msdn.microsoft.com</os:homepageUrl>
    5:    <os:display>
    6:      <os:name>Find on MSDN</os:name>
    7:      <os:description>Find more information on MSDN</os:description>
    8:      <os:icon>https://msdn.microsoft.com/favicon.ico</os:icon>
    9:    </os:display>
   10:    <os:activity category="Technical">
   11:      <os:activityAction context="selection">      
   12:        <os:execute action="https://search.msdn.microsoft.com/Default.aspx" method="get">
   13:          <os:parameter name="Query" value="{selection}" type="text" />
   14:        </os:execute>
   15:      </os:activityAction>
   16:    </os:activity>
   17:  </os:openServiceDescription>

 

Here's what it looks like from the user's point of view from within IE 8 (available via right-click):

image

The accelerator opens a new tab in IE 8 with the results of your MSDN search. Pretty neat! If I had control over the MSDN site I could add a lightweight preview page to popup a quick view of the results (this is e.g. what some of the mapping accelerators do).

To make this available on a website I would just publish the XML file and provide a button to allow the user to install my accelerator. Here's the code for my sample page:

   <%@ Page Language="IronPython" CodeFile="Default.aspx.py" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="https://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Add Accelerator Test Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <button id="myButton"
        onclick="window.external.AddService('MSDNAccelerator.xml')">
        Add the MSDN Accelerator to Internet Explorer 8</button>
    
    </div>
    </form>
</body>
</html>

For your convenience I've attached the sample project including the test ASP.NET page plus my accelerator to this post (see link at the bottom).

And here's what it looks like when you click:

image

 

Common IE 8 accelerators such as those for Facebook and ebay can be installed from https://www.ieaddons.com/en/accelerators/. You can manage (e.g. remove) your accelerators via the Tools->Manage Add-ons window as shown below:

 

image

 

So all in all, pretty easy - you can add a useful accelerator to any site in less than 15 minutes I would guess. A little more work (e.g. on a preview) would make it even more valuable.

MSDNAccelerator.zip