Tuesday, March 3rd, 2009

Dreaming… how to write a browser extension in the future

Category: Browsers

Aza Raskin has been thinking about extensions. Whipping out the XUL can be a little tricky, so what can we do to make life easier? Aza has written out his dream way to write a Firefox extension and I hope it goes from being a dream, to somewhat reality.

He gives some use cases for extensions, and how they would be developed, including:

  • Weather Badge in the Navigation Bar
  • Clock in the Status Bar
  • Tab Recover

Let’s take a look at a world in which New Tab gives you the most recently closed tabs via:

  1. <extension>
  2.   <li id="menu-item">Open last closed tab</li>
  3.  
  4.   <script id="init">
  5.     Browser.Windows.Tabs.onload(function( window ){
  6.       if( window.location != "about:blank" ) return;
  7.  
  8.       /* Construct a list (li's) of recently closed tabs in HTML format. */
  9.       var recentTabs = ...;
  10.       $( "li", recentTabs).onclick(function()){
  11.         window.open( this.url );
  12.       });
  13.  
  14.       $(window.document.body).append( recentTabs );
  15.     });
  16.  
  17.     Browser.onload(function(){
  18.       Browser.UI.ContextMenu.add({
  19.         id: "menu-item",
  20.         onclick: function(){
  21.           /* Get the last closed tab. */
  22.           var lastClosedTab = ...
  23.           window.open( lastClosedTab.url );
  24.         }
  25.       });
  26.     });
  27.   </script>
  28.  
  29. </extension>

What do you think? How would you like to write an extension? I love the dream where I sit at Bespin.Future where I can say “newaddon Foo based on Tab Recover” that opens up the entire system, let’s you hack on it giving you real time details on how you are doing (you are using the Foo API in a way that will use a lot of resources) and that has a nice “Deploy Add-on” button that puts it on a server, sends it to AMO, all from the browser.

Posted by Dion Almaer at 12:55 am
1 Comment

++++-
4.4 rating from 25 votes

1 Comment »

Comments feed TrackBack URI

I liked how his blog entry said “I prefer its super-low barrier to entry.” when referring to the web. good comment. It would be cool if writing extensions were as simple as writing html and javascript.

Comment by drewlesueur — March 4, 2009

Leave a comment

You must be logged in to post a comment.