Writing IE8 accelerator in 15 minutes (bookmark on Delicious)

Being teased from my colleague Radenko (http://blog.developers.ba) that IE8 accelerators are not so useful as FF addons, and that he can’t find appropriate accelerator for Delicious, I decided to find him one on internet using search and www.ieaddons.com. I couldn’t find anything than this (yes, it has more options and no, I haven’t read it’s source code before I wrote my own), created to IE8 while it was in beta 2. However, I wanted to see how difficult it is to create simple one, and decided to try writing it.

Accelerators are XML files that let you act on data in a web page (from MSDN):

Accelerators let you act on data in a Web page. You can select a few lines of text and send it to a blog or email it with a click. Using a previously installed Accelerator, this action "executes" the desired activity by navigating to the desired Web site with the selected portion of the article already available in the edit field. You can also act on data without going to another Web site using "preview" Accelerators; for example, you can translate a word or map an address. Hover over an Accelerator with your mouse to view the preview window.

First, I found “OpenService Accelerators Developer Guide” on MSDN, that is very detailed, contains fields description and one full sample. Then, I found page on Delicious blog that contains code for “Bookmark this page” button.

Basically, it’s needed to pass page URL and Title to “Save a new bookmark” page on Delicious, and of course, you need to be logged in to your account.

Code for this accelerator:

<?xml version="1.0" encoding="UTF-8" ?>
<os:openServiceDescription
  xmlns:os="http://www.microsoft.com/schemas/openservicedescription/1.0">
  <os:homepageUrl>http://www.delicious.com</os:homepageUrl>
  <os:display>
    <os:name>Add to Delicious</os:name>
    <os:icon>http://www.delicious.com/favicon.ico</os:icon>
    <os:description>Add this page to Delicious</os:description>
  </os:display>
  <os:activity category="Add">
    <os:activityAction context="document">
      <os:preview action="http://www.delicious.com/save?url={documentUrl}" />
      <os:execute method="get" action="http://www.delicious.com/post">
        <os:parameter name="url" value="{documentUrl}" />
        <os:parameter name="title" value="{documentTitle?}" />
      </os:execute>
    </os:activityAction>
  </os:activity>
</os:openServiceDescription>

This is a simple proof of concept, but you can use it before Delicious publishes official version. It wears “Works on My Machine” seal:

works-on-my-machine-starburst

Accelerators are added to IE using javascript code, that, in most cases, is attached to a button onClick event: <button id="myButton" onclick="window.external.AddService('http://weblogs.asp.net/blogs/draganpanjkov/IE8/addDelicious.xml')">Add to Delicious</button>

Here is a button you can use to add this accelerator to Internet Explorer 8 RTW

 

I hope you’ll find it useful :)

Dragan

Published Friday, March 20, 2009 3:11 PM by panjkov

Comments

# re: Writing IE8 accelerator in 15 minutes (bookmark on Delicious)

Monday, June 15, 2009 11:03 AM by panjkov

In general, you should only publish new version of your accelerator to the same place as previous one, and when you click on it, instead of "Add" optiopn you'll be able to replace it.

Leave a Comment

(required) 
(required) 
(optional)
(required)