David Walsh Blog Firefox Toolbar

By on  

Update: The toolbar will now attempt to install when you click the link. .htaccess FTW!

I spent a few hours on Saturday doing something I've always wanted to learn how to do -- create a Mozilla Firefox extension ("addon"/plugin). I wanted to start with something fairly simple but useful so I created a David Walsh Blog toolbar. My toolbar provides quick links to different areas of my site as well as links to MooTools resources and recommended websites.

David Walsh Toolbar

While I'd love to do one article on how I created the plugin, I think it would end up being either 200 pages long or short without necessary details. Expect a few articles with regard to making Firefox extensions. You may also access all of this project's files on GitHub. Here's a quick summary of the code files.


#davidwalshtoolbar-search-toolbar-box	{ color:#666; }
#davidwalshtoolbar-button-mootools		{ list-style-image:url("mootools.png"); min-width:100px; }
#davidwalshtoolbar-button-friends-csstricks	{ list-style-image:url("csstricks.png"); }
#davidwalshtoolbar-button-mootools > .toolbarbutton-menubutton-button { -moz-box-orient: horizontal; }


<?xml version="1.0"?>
<?xml-stylesheet href="chrome://davidwalshtoolbar/skin/davidwalshtoolbar.css" type="text/css"?>
<overlay id="davidwalshtoolbar-overlay" xmlns="">
	<script type="application/x-javascript" src="chrome://davidwalshtoolbar/content/davidwalshtoolbar.js" />
	<toolbox id="navigator-toolbox">
		<toolbar id="davidwalshtoolbar-toolbar" context="toolbar-context-menu" accesskey="d" class="chromeclass-toolbar" toolbarname="David Walsh Blog Toolbar" hidden="false" persist="hidden">
			<!-- Home -->
			<toolbarbutton label="David Walsh Blog" id="davidwalshtoolbar-button-home" accesskey="d" image="chrome://davidwalshtoolbar/skin/logo.png" oncommand="dwb_loadURL('');" tooltiptext="Click here to go to the David Walsh Blog homepage." />
			<!-- Sugar Menus -->
			<toolbarbutton label="Topics" id="davidwalshtoolbar-button-sugar" type="menu" accesskey="o" image="chrome://davidwalshtoolbar/skin/sugar.png" tooltiptext="Which sugar would you like to learn more about?">
					<menuitem oncommand="dwb_loadURL('');" label=".htaccess" />
					<menuitem oncommand="dwb_loadURL('');" label="AJAX" />
					<menuitem oncommand="dwb_loadURL('');" label="Apache / Server" />
					<menuitem oncommand="dwb_loadURL('');" label="APIs" />
					<menuitem oncommand="dwb_loadURL('');" label="Blog" />
					<menuitem oncommand="dwb_loadURL('');" label="Bookmarking / Social" />
					<menuitem oncommand="dwb_loadURL('');" label="Books" />
					<menuitem oncommand="dwb_loadURL('');" label="Browsers" />
					<menuitem oncommand="dwb_loadURL('');" label="CSS / Design" />
					<menuitem oncommand="dwb_loadURL('');" label="Google" />
					<menuitem oncommand="dwb_loadURL('');" label="Guest Blogger" />
					<menuitem oncommand="dwb_loadURL('');" label="Hosting / Domain" />
					<menuitem oncommand="dwb_loadURL('');" label="Javascript" />
					<menuitem oncommand="dwb_loadURL('');" label="jQuery" />
					<menuitem oncommand="dwb_loadURL('');" label="link()" />
					<menuitem oncommand="dwb_loadURL('');" label="Microsoft" />
					<menuitem oncommand="dwb_loadURL('');" label="MooTools" />
					<menuitem oncommand="dwb_loadURL('');" label="MySQL" />
					<menuitem oncommand="dwb_loadURL('');" label="Optimization" />
					<menuitem oncommand="dwb_loadURL('');" label="PHP" />
					<menuitem oncommand="dwb_loadURL('');" label="Poll" />
					<menuitem oncommand="dwb_loadURL('');" label="rand()" />
					<menuitem oncommand="dwb_loadURL('');" label="Security" />
					<menuitem oncommand="dwb_loadURL('');" label="Shell" />
					<menuitem oncommand="dwb_loadURL('');" label="Theory / Ideas" />
					<menuitem oncommand="dwb_loadURL('');" label="Usability / Accessibility" />
					<menuitem oncommand="dwb_loadURL('');" label="XML / XHTML" />
			<!-- Twitter -->
			<toolbarbutton label="Twitter" id="davidwalshtoolbar-button-twitter" accesskey="t" image="chrome://davidwalshtoolbar/skin/twitter.png" oncommand="dwb_loadURL('');" tooltiptext="Follow the blog on Twitter!" />
			<!-- GitHub -->
			<toolbarbutton label="GitHub" id="davidwalshtoolbar-button-github" accesskey="g" image="chrome://davidwalshtoolbar/skin/git.png" oncommand="dwb_loadURL('');" tooltiptext="Grab my code on GitHub." />
			<!-- Chat -->
			<toolbarbutton label="Chat" id="davidwalshtoolbar-button-chat" accesskey="h" image="chrome://davidwalshtoolbar/skin/chat.png" oncommand="dwb_loadURL('');" tooltiptext="Join #davidwalshblog chat on IRC!" />
			<!-- Contact -->
			<toolbarbutton label="Contact David Walsh" id="davidwalshtoolbar-button-chat" accesskey="n" image="chrome://davidwalshtoolbar/skin/contact.png" oncommand="dwb_loadURL('');" tooltiptext="Get a hold of me." />
			<!-- (sep) -->
			<toolbarseparator />
			<!-- MooTools -->
				 <toolbarbutton label="MooTools" id="davidwalshtoolbar-button-mootools" type="menu-button" accesskey="m" oncommand="dwb_loadURL('');" tooltiptext="Visit the MooTools website.">
							<menuitem label="Download MooTools Core" class="menuitem-iconic" tooltiptext="Create a custom build of the MooTools Core." oncommand="dwb_loadURL(''); event.stopPropagation();" />
							<menuitem label="Download MooTools More" class="menuitem-iconic" tooltiptext="Create a custom build of the MooTools More." oncommand="dwb_loadURL(''); event.stopPropagation();" />
							<menuitem label="David Walsh MooTools Plugin Downloader" class="menuitem-iconic" tooltiptext="Download David Walsh's MooTools Plugins" oncommand="dwb_loadURL(''); event.stopPropagation();" />
							<menuitem label="MooTools on GitHub" class="menuitem-iconic" tooltiptext="Fork the MooTools project or browse the source!" oncommand="dwb_loadURL(''); event.stopPropagation();" />
							<menuitem label="MooTools' LightHouse" class="menuitem-iconic" tooltiptext="File a ticket or submit a patch." oncommand="dwb_loadURL(''); event.stopPropagation();" />
							<menuitem label="MooTools Users Group" class="menuitem-iconic" tooltiptext="Connect with other MooTools users." oncommand="dwb_loadURL(''); event.stopPropagation();" />
							<menuitem label="The MooTools Team" class="menuitem-iconic" tooltiptext="Learn about the people behind the project." oncommand="dwb_loadURL(''); event.stopPropagation();" />
			<!-- (sep) -->
			<toolbarseparator />
			<!-- Search -->
			<toolbaritem id="davidwalshtoolbar-search-toolbar-item" persist="width">
				 <textbox id="davidwalshtoolbar-search-toolbar-box" value="Search the blog..." flex="1" minwidth="100" width="150" onfocus="dwb_focus(true);" onblur="dwb_focus(false);" onkeypress="dwb_keypress(event);" />
			<toolbaritem flex="0">
				 <toolbarbutton id="davidwalshtoolbar-search-toolbar-button" label="Blog Search" tooltiptext="Search the David Walsh Blog" image="chrome://davidwalshtoolbar/skin/search.png" oncommand="dwb_searchBlog(event);event.stopPropagation();" />
			<!-- (sep) -->
			<toolbarseparator />
			<!-- Script n Style -->
			<toolbarbutton label="Script & Style" id="davidwalshtoolbar-button-sns" accesskey="s" image="chrome://davidwalshtoolbar/skin/sns.png" oncommand="dwb_loadURL('');" tooltiptext="Great JavaScript and CSS articles submitted by you!" />
			<!-- Friends -->
			<toolbarbutton label="Friends" id="davidwalshtoolbar-button-friends" type="menu" accesskey="f" image="chrome://davidwalshtoolbar/skin/friends.png" tooltiptext="Check out these great sites.">
					<menuitem class="menuitem-iconic" oncommand="dwb_loadURL('');" label="ClientCide" image="chrome://davidwalshtoolbar/skin/clientcide.png" />
					<menuitem class="menuitem-iconic" oncommand="dwb_loadURL('');" label="Christoph Pojer" image="chrome://davidwalshtoolbar/skin/zilence.png" />
					<menuitem id="davidwalshtoolbar-button-friends-csstricks" label="CSS-Tricks" class="menuitem-iconic" tooltiptext="Chris Coyier's Blog" image="chrome://davidwalshtoolbar/skin/csstricks.png" oncommand="dwb_loadURL('');" />
					<menuitem class="menuitem-iconic" oncommand="dwb_loadURL('');" label="Eric Wendelin" image="chrome://davidwalshtoolbar/skin/eriwen.png" />

The JavaScript

/* forwards document to new URL */
function dwb_loadURL(url)
    window._content.document.location = url;

/* executes the search */
function dwb_searchBlog()
	var term = document.getElementById('davidwalshtoolbar-search-toolbar-box').value;
	if(term.length > 0 && term != 'Search the blog...') dwb_loadURL('' + encodeURIComponent(term));

/* listen for focus/blur on the search box */
function dwb_focus(state)
	var box = document.getElementById('davidwalshtoolbar-search-toolbar-box');
	if(state) { //focus
		if(box.value == 'Search the blog...') box.value = '';; = '#000000';
	else {
		if(box.value == '') {
			box.value = 'Search the blog...'; = '#666666';

/* listen for search commit via keyboard */
function dwb_keypress(event)
	if (event.keyCode == event.DOM_VK_RETURN) dwb_searchBlog();

Go ahead and download the toolbar if only to see what I put together. To install the toolbar in Firefox, click "File" >> "Open File," and Firefox will ask you to install the plugin.

I hope it sparks a desire for you to create your own Mozilla extension. Keep in mind the toolbar is version 0.1. Please share your thoughts and ideas!


Recent Features

  • Introducing MooTools&nbsp;Templated

    One major problem with creating UI components with the MooTools JavaScript framework is that there isn't a great way of allowing customization of template and ease of node creation. As of today, there are two ways of creating:

  • An Interview with Eric&nbsp;Meyer

    I've always wanted to interview Eric Meyer. His early CSS books are a big reason this blog exists today and the reason why I'm a web developer. Eric gave me some time to hit the history of CSS,...

  • How to Create a Twitter&nbsp;Card

    One of my favorite social APIs was the Open Graph API adopted by Facebook.  Adding just a few META tags to each page allowed links to my article to be styled and presented the way I wanted them to,...

Incredible Demos

  • Form Element AJAX Spinner Attachment Using&nbsp;MooTools

    Many times you'll see a form dynamically change available values based on the value of a form field. For example, a "State" field will change based on which Country a user selects. What annoys me about these forms...

  • MooTools dwCheckboxes&nbsp;Plugin

    Update / Fix: The checkboxes will no longer toggle when the "mouseup" event doesn't occur on a checkbox. Every morning I wake up to a bunch of emails in my Gmail inbox that I delete without reading. I end...

  • Fancy FAQs with jQuery&nbsp;Sliders

    Frequently asked questions can be super boring, right? They don't have to be! I've already shown you how to create fancy FAQs with MooTools -- here's how to create the same effect using jQuery. View...


  1. Ahmed

    Sweet, now I know how to make a Firefox toolbar…
    I wish I could also know how to make search boxes or forms with checkboxes. Where’s the documentation?

  2. I’ve added a MIME type for .xpi to my server so that it will install the toolbar when you click it. Sweet!

  3. @David Walsh, how did you compile all of that into an .xpi? If you could explain that towards the end of the post that would really complete this. Thank you very much for sharing!

  4. Ahmed

    @David Walsh

    This is so cool! I’m so getting something similar done for my website heh :D

  5. @Dan: More to come. I couldn’t fit it into one post so I wanted to get this toolbar out first. Look forward to future articles breaking things down.

  6. Hi David,
    I think that this is one of the best articles/tutorial/snippet you wrote… I like it a lot

  7. Nice work!! Great to see you hacking a Firefox add-on together! :D

  8. Very nice! I tried to make a Firefox addon last year and had hard time with it. Using this, I might be able to get somewhere next time.

  9. @Ryan: Apart from David’s excellent article, I’d recommend looking at this recent posting by Robert Nyman:

  10. @Ryan: Thank you, but this is only the release post. I’ll have many more about creating a plugin to come. I promise to explain this better.

    @Rey Bango: Thank you for sharing!

  11. Great!!! I was curious about a subject but did not try at all. I think I can do a few experiments now. Thank you!!!

  12. Shrike

    Do you know how to do a periodical ajax request for example for check messages like google toolbar?


    ps. I suggest you to add the updateUrl in the install.rdf for check updates ;),_Update_and_Compatibility

  13. Thank you for the inspiration. Here is a preview of mine.

  14. Great addition,

    Already install it and made one for my site using yours as a template.

    I hope you continue with this and add a mini tutorial for adding login support to a page.


  15. Spooky

    Not working with FF 3.5 :(

  16. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.


  17. You need to update the maximum version of Firefox your toolbar can be installed on. I put my toolbar to Firefox version 8.*.* . Try that and it will save you time updating it every time for users to use.

  18. Could you please update the version number. It will not install on Firefox 3.6.13

  19. Your GitHub link is 404ing :(

  20. [...] and menuitem elements. The menu information lives right within the page so there’s no need to create a custom plugin. Let me show you how you can create your own custom context menus from basic [...]

  21. [...] David Walsh Blogg Firefox Toolbar [...]

  22. [...] David Walsh Blog Firefox Toolbar [...]

  23. […] menu and menuitem elements. The menu information lives right within the page so there's no need to create a custom plugin. Let me show you how you can create your own custom context menus from basic […]

  24. […] I posted version 0.1 of the David Walsh Blog Toolbar for Firefox. Unfortunately that led to an awkward conversation with […]

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!

Use Code Editor