Unpacking and Editing a Chrome Extension

I've been having an issue with one of my chrome extensions recently - the keyboard navigation extension that I blogged about previously. This is a huge problem for me because without this extension, I can't "click" on anything on the internet! It was working on some pages, but on others it was drawing elements but not styling them correctly. The extension doesn't seem to be actively maintained, so I realised I was going to have to dive into the extension itself to understand the problems and have any chance of fixing it. Hurrah for open source software (not that I really write any js but I figured if I could understand the problem, maybe I could ask more intelligent questions)

Unpacking a Chrome Extension

Actually this didn't take much unpacking once I found it. For me on ubuntu, all my files were in ~/.config/google-chrome/Default/Extensions/. The key is to visit chrome://extensions, and turn on "Developer mode" which is a tickbox in the top right corner. Then copy the ID of the extension you're going to be working with.

In the extensions directory, there are directories named in a garbledy way, but the directory names match the IDs of the extensions you see in chrome, so copy whichever extension you need to another location. You can then click the "Load unpacked extension" button to use your version of the extension instead of the existing one (I didn't uninstall the previous version and it didn't seem to cause a problem).

(I did find that I needed to add "version": 2 to the manifest file, but I think that was just because this is an older extension. If you need to do this, chrome gives you a very clear error and link to more info when you try to load the extension)

At this point, you can edit to your heart's content, and then when you're ready to try out your changes in Chrome, save the files and click on the Reload link for your extension.

Fixing the Keyboard Navigation Extension

I'm not sure exactly what was causing the problem with the keyboard navigation extension, I observed all the little labels being created at the end of the page, but not styled or moved correctly ... critically the stylesheet includes a "position: absolute" which is how you know which label is for which page element! To fix the problem, I applied all the style properties programmatically in the code, bit of a hacky solution but it works for me.

I may also have taken the opportunity to de-orange the little labels too!

If you'd like the hacked version of the extension, you can find it on bitbucket: https://bitbucket.org/lornajane/keyboard-navigation-for-chrome/overview

5 thoughts on “Unpacking and Editing a Chrome Extension

  1. Now updated to support all the dropdown boxes on github's site, which produces too many labels in quite a few places, but does help hugely on github and has given additional useful links in a bunch of other places too so I think it's mostly a win.

  2. Hi, my google extensions folder in windows is in:
    C:\Documents and Settings\User\Configurações locais\Dados de aplicativos\Google\Chrome\User Data\Default\Extensions

  3. Thanks Lorna Jane!

    On Windows 7 with the Users folder located on C:, the extension folder can be found here:
    C:\Users\\AppData\Local\Google\Chrome\User Data\Default\Extensions

  4. this guide nowhere talks of unpacking an extension.
    However for any needy person wanting to actually 'unpack' an ext. and not just 'load an unpacked' one
    , this is the answer
    Struggled hard for this:
    Install 7-Zip
    Right click on any crx -> 7-Zip -> Open Archive

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.