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

Like this post? +1 it!  

Related Posts:

32 comments to Word and Character Count – Google Chrome Extension

  • I have no idea what you are talking about :-) The only extensions I know are electrical cord extensions…

  • @Sraboney
    I think Anupa would share the same sentiment as you!

  • Congrats, you are a tech guy in more ways than one!

  • 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.

  • Anthony

    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.

  • Anthony

    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…

  • I'll keep an eye out for any news re: the word count being displayed above the W! Sounds like a good idea. :)

  • Gee, thanks! It’s perfect, just what I was after, a lightweight solution for a lightweight browser. Cheers :)

  • IIsi 50MHz

    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

  • Hi Bahwd,Thanks for the extension. It was just what I was looking for and appears to work perfectly :)

  • Hi Bahwd,Thanks for the extension. It was just what I was looking for and appears to work perfectly :)

  • [...] just to get a word count is annoying. So I was happy to stumble across Word Count by developer Bhagwad Jal Park. It’s a simple little Chrome extension that lets you highlight some text on a web page, then [...]

  • [...] just to get a word count is annoying. So I was happy to stumble across Word Count by developer Bhagwad Jal Park. It’s a simple little Chrome extension that lets you highlight some text on a web page, then [...]

  • What an awesome plugin, thanks so much it just what I've been looking for.

  • Bud K

    To install Word Count, the extension needs access to all my personal data on websites and my browsing history. That's really overkill and intrusive. Is this your or Google's requirement.

    • It's not my requirement at all I assure you. I don't know why that message pops up, but you can always take a look at the code if you want to make sure that everything's ok…

  • [...] in Chrome using the Greasemonkey Add onBy bhagwad, on August 19th, 2010A little while back I had written a Google Chrome extension to count the words in any selection on a page. You can download it straight from here if you [...]

  • Hey bhagwad,

    thanks so much, this extension is just what I was looking for. I have been using Word Count Plus for Firefox for ages, but it’s not wirking w/ FF 3.6. The fact that I now have an extension that does the job for Chrome is awesome. Thanks so much!

  • Thanks man! Wonderful stuff!!!
    I was looking for it for some time. I need it for article selection purpose for my magazine. And the journey is over now!

    Many Thnaks.
    Amir

  • Just wanted to say thanks for this extension. It is very helpful.

  • Katie

    I really need this to work for my school work. I have been searching and found a few ways to count words, 2 of which were your ideas, but none work on my school website discussion board. I don’t know if they don’t recognize the text box or what the deal is. After the deadline extension works on the site but other extensions don’t. It says character count:1 word count: 0 no matter how many words or characters I type and highlight.

  • Sílvia

    Awesome extension, exactly what I was looking for. Thank you very much sir! ;)

  • strang3love

    doesnt work in gmail unfortunately

  • Hello,

    First thank you for developing this. It can be extremely useful for me as I work for a company that helps non profits send text messages, and character count is always a concern. Unfortunately, in Chrome, it is not able to count characters when I’m typing an email in gmail. This is my most common use case.

    This feature would make my month!

    Thanks,

    Mike

    • Thanks for feedback Michael. In think there are technical limitations to using the extension in Gmail…but I’m so far removed from that phase that I’m not sure I know myself now how the extension works!

  • sunn_er

    Thank you for extensions :)

    This is open-source ?

    • Sure, just download the crx file from Google, open it up and take a peek :)

      • sunn_er

        Hmm … Someone else for his extension told me the same thing. ” download the crx from google ” But i can not save as the crx file on my desktop as a file. Chrome automatically install the crx file and removes it. I try it to download from firefox but the install button was disabled. How can i download it ?

        And if we can download all crx files and we can open it, that means all extensions for chrome are open source ?

        Thank you again! :)

        • You can get the crx file of any installed Chrome extension in Windows by going to this folder:

          C:/Users/%username%/AppData/Local/Google/Chrome/User Data/Default/Extensions

          Enjoy :)

Leave a Reply