DCSIMG
How to build a Simple IE8 Accelerator - Guy Burstein's Blog

Guy Burstein's Blog

Developer Evangelist @ Microsoft

News

Guy Burstein The Bu

Disclaimer
Postings are provided 'As Is' with no warranties and confer no rights.

Guy Burstein LinkedIn Profile

TwitterCounter for @bursteg

Links

Articles

Blogs I Read

How to build a Simple IE8 Accelerator

How to build a Simple IE8 Accelerator

This post is a step by step guide for building IE8 Accelerators.

A Short Introduction to IE8 Accelerators

Accelerators are used to make the user more productive while surfing the net, by:

How to build a Simple IE8 Accelerator 1. Speeding up the process of getting additional information about a meaningful string (address, stock quote, a product, a twitter account name, etc). In this sample

2. Allowing user to perform a quick action on a selected text.

From a technical perspective, Accelerators define 2 actions: Preview and Execute. When the user selects some text and hover over an accelerator, the Preview action is being performed - the selected text is sent to a defined url, that returns a 320x240 web page with a preview of the data.
When the user clicks the Accelerator, the Execute action is performed and the browser navigates to a page passing it the selected text as a parameter.

To build IE8 Accelerators, we have several steps to do:

  1. Building an Accelerator Page
  2. Defining the Accelerator OpenService Xml
  3. Registering the Accelerator with IE8
  4. Using the Accelerator

To make sure this guide is generic enough for every Accelerator you may think of and not just for Twitter profiles, I am leaving the twitter logic to the last part of this post.

1. Building an Accelerator Page

Create a new ASP.Net Web Application in Visual Studio 2008 or open an existing one.

Add a new Web Form for the Accelerator Preview. In the page code behind, extract the query string parameters write them to the Response object:

protected void Page_Load(object sender, EventArgs e)

{

  foreach (string param in Request.QueryString.AllKeys)

  {

    Response.Write(param + " = " + Request.QueryString[param] + "<br />");

  }

}

Test the page: Navigate to the accelerator’s url, and add several parameters. For example:

http://localhost:16319/ShowTwitterUser.aspx?data1=guy&data2=burstein

How to build a Simple IE8 Accelerator  

Defining the Accelerator OpenService Xml

In order to register the Accelerator with a user’s browser, we have to create an xml file with the details of the Accelerator.

Add an Xml file to the web application that defines the Accelerators metadata required by the browser.

<openServiceDescription
     
xmlns=http://www.microsoft.com/schemas/openservicedescription/1.0>

  <homepageUrl>http://www.bursteg.net/</homepageUrl>

  <display>

    <name>Twitter Profile Accelerator</name>

    <icon>http://www.twitter.com/favicon.ico</icon>

  </display>

  <activity category="Define">

    <activityAction context="selection">

      <preview action="http://www.bursteg.net/Twitter/ShowTwitterUser.aspx">

        <parameter name="selection" value="{selection}" />

      </preview>

      <execute action="http://www.bursteg.net/Twitter/ShowTwitterUser.aspx">

        <parameter name="documentUrl" value="{documentUrl}" />

        <parameter name="documentTitle" value="{documentTitle}" />

        <parameter name="documentDomain" value="{documentDomain}" />

        <parameter name="documentHost" value="{documentHost}" />

        <parameter name="selection" value="{selection}" />

      </execute>

    </activityAction>

  </activity>

</openServiceDescription>

Few things to notice in the Accelerator Xml:

1. There is some meta data about the accelerator such as homepage Url and the display name and icon.

2. The Activity node defines a category to which this accelerator belongs to. There are some default categories like Map, Translate, Blog etc, but users can manage their categories using the Manage Add-ons Dialog.

3. As described earlier, the accelerator defines 2 actions, preview and execute, each defines a Url to call to when clicked / previewed, and several parameters to pass to the target page.

Register the Accelerator with the User’s Browser

In a page of your chose (for example Default.aspx) add a button that registers the accelerator when clicked:

<input id="btnRegister" type="button" value="Add Accelerator to IE8" 
      onclick="BLOCKED SCRIPTwindow.external.AddService('TwitterProfileAccelerator.xml');" />

How to build a Simple IE8 Accelerator

When the user clicks on the above button, a dialog pops us asking his permission to add this accelerator to his browser, and whether to make it the default accelerator in its category.

How to build a Simple IE8 Accelerator

Using the Accelerator

After the user has added the accelerator to his browser he can start using it. Select some text and the accelerator box will appear next to it. Click on it add hover over the new accelerator. This should make an HTTP request to the accelerator page passing it the text you have selected.

How to build a Simple IE8 Accelerator

If you click on the accelerator, IE8 will open the target page in a new tab passing it the selected text and additional information as defined in the accelerator xml.

How to build a Simple IE8 Accelerator

Summary

In this pot I took the steps needed to build an accelerator. You can follow them you build your own accelerators and add additional logic to provide more interaction with your uses.

Enjoy!

Comments

Pini Dayan said:

Great post! Thanks Guy

# June 29, 2009 3:39 PM

Steinberger said:

Great post indeed!

How do you register your accelerator at the Microsoft accelerators  gallery?

# June 29, 2009 4:43 PM

גיא בורשטיין said:

@Steinberger:

1. Go to ieaddons.com

2. create a user

3. upload your enhancements

4. contact me as the gallery moderator and i'll approve your stuff

Guy

# June 29, 2009 4:53 PM

How to build a Simple IE8 Accelerator - Guy Burstein's Blog | XML Developer said:

Pingback from  How to build a Simple IE8 Accelerator - Guy Burstein&#39;s Blog | XML Developer

# July 1, 2009 7:56 AM

Prem Kumar.P said:

sorry continued from the earlier msg, the error that i get is the following:

"There was a problem with the Accelerator provider's information."

cheers!

prem

# July 2, 2009 12:47 PM

How To Build a Simple Ie8 Accelerator - Guy Burstein’s Blog said:

Pingback from  How To Build a Simple Ie8 Accelerator - Guy Burstein&#8217;s Blog

# October 4, 2009 2:05 AM

Cx90 Used Tractors, Cx90 Used Apple Farm said:

Pingback from  Cx90 Used Tractors, Cx90 Used Apple Farm

# May 21, 2010 12:37 AM

K3500 Sound Catalytic Converter, G35 P3500 Van Bumper - 108.tvshowzone.com said:

Pingback from  K3500 Sound Catalytic Converter, G35 P3500 Van Bumper - 108.tvshowzone.com

# May 25, 2010 2:12 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: