Word and Character Count – Google Chrome Extension

Jump straight to the Extension!

Yesterday, I wrote my first Google Chrome extension. The feature that was really keeping me on Firefox all this while was theĀ Ubiquity add on, and though it still works, Mozilla has decided to put a hold on Ubiquity’s development.

Without Ubiquity to hold me back, I succumbed to Google Chrome’s seductive minimalistic interface, blistering speed and overall smoothness. And since the Chrome Extension gallery didn’t have an extension to count the words and characters in a selection, I decided to write one myself since it’s absolutely essential to me as a writer.

This is the first time I’m writing an extension for a browser (I don’t count Ubiquity commands as extensions as such), and the results are pretty neat. It took me well over a day to figure out exactly what the architecture of an extension is and I almost lost my head trying to implement things like message passing, but I finally came through with the goods :)

This is what the extension I wrote looks like – Word and Character Count:

Google Chrome Extension - Word and Character Count
Google Chrome Extension - Word and Character Count

I’m not much of a designer, so the logo for my extension is just a big blue “W” and the output simply gives the number of words and characters – good enough for my needs. Initially it was just a word count extension and then two people were kind enough to use it and suggest that I include a character counter too – which I did promptly.

So if you’re a writer using Google Chrome, be sure to install my humble contribution to the Google Chrome universe :D

What do you think of this post?
  • Agree (3)
  • Don't Agree but Interesting (1)
  • You're an asshole (1)

38 thoughts on “Word and Character Count – Google Chrome Extension”

  1. Welcome to the Chrome fold. I have actually been going backwards to Firefox because of some strange problem Chrome has been having resolving addresses recently for me. I can't figure it out. I think my traffic is being intercepted by my arch-enemy, Comcast.

    I seriously need to learn some programming skills. Crimefighting isn't paying very well these days.

    I was going to install the extension, but I had a troubling warning that it needed access to browsing history & private information. Scary. Are you spying on me, too? Are you an agent of Comcast?

    Me – No, nothing of the sort :) . I guess Chrome is trying to tell you that it could happen. But it's all fine. There aint any such functionality.

    Reply

  2. I've been waiting for something like this… thanks! Any chance you could have an option to always show the number of words selected? (so that you don't have to click on the W)

    Me – I don't think that's possible. I may be wrong here since I've only just started on Chrome, but from what I've seen, the Google Chrome extension system isn't as powerful as the Firefox plugins and add ons system…So lots of things might be impossible.

    Reply

  3. What if the word (or character) count could be displayed as a number directly on top of the W, similar to the way that the number of emails appears on a mail checking extension.

    Me – Interesting idea. Let me take a look at the mail checking extension…

    Reply

  4. I posted this workaround for the Google Docs problem on your extension's info page.

    This should help you with docs.google.com (as long as the iframe's ID is "wys_frame"):

    // Get a reference to the iframe (iframe must be on the same domain)
    docsiframe=document.getElementById('wys_frame');
    // Sample to display the selection we just got
    alert(docsiframe.contentWindow.getSelection().toString());

    Me – Thanks a lot! Will try and work on it over the weekend

    Reply

Leave a Comment