Unpacking and Editing a Chrome Extension
Join the DZone community and get the full member experience.Join For Free
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
. the key is to visit
, 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
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
Published at DZone with permission of Lorna Mitchell, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.