Home Contact

Brian Sherwin's Blog

Moving at the Speed of .Net

News

Tag Cloud


Archives

Links

Syndication:

Simple Browser Extension yields cool idea!

While researching a way to provide bookmarks inside of a multi-server web application, I came across something I already knew about, but actually hadn't ever done in a production environment--the context menu extension.

Three Steps:

  1. Create the menu item
  2. Implement the event
  3. Do something cool

Step 1

This is as simple as creating the Name of the menu in the Registry

HKLU/Software/Microsoft/Internet Explorer/MenuExt/<Menu Item>

Name your menu item and set the following

  1. (default) - Location of script
  2. Contexts - What type of stuff can respond to your menu item using the following bitmask values:
    • Default (0x1)
    • Images (0x2)
    • Controls (0x4)
    • Tables (0x8)
    • Text Selection (0x10)
    • Anchor (0x20)
  3. Flags (optional)-I didn't use it, so I won't explain it.

Step 2

This is where the script comes in.  I used a much improved script, but this should give you an idea of how it works. Create an HTML page that only contains the following and link to it as described above.

<script>
    var w = window.external.menuArguments;
    var l = w.document.activeElement;
    alert('Bookmarking ' + l);
</script>

Step 3

Do something cool.  This is where I will leave it up to you.  Personally, the script creates a favorite in my profile as well as hands it off to a web service that puts it in a database for me. This way I can have my links all going to one place. I'll extend this at some point, but I'll never have to worry about bookmarking a link on one machine and then losing it.


Feedback

No comments posted yet.


Post a comment





 

Please add 8 and 2 and type the answer here: