How to View the Source Code of a Chrome Extension
There are two main reasons why you may want to read the source code of any Google Chrome extension (including Web Apps and Chrome Themes):
- If the Chrome extension has been created by an unknown developer, you want to ensure that it does what the description says and nothing more. You would not like to download a Chrome extension on your machine that tracks your search logs or browsing history.
- You are learning how to write a Chrome extension (or theme) and are curious to know how some of the good extensions have been written. The licenses of some Chrome extensions may even allow code reuse with attribution.
Google Chrome extensions and web apps are distributed as CRX files but they are standard ZIP files that you can easily extract using WinZip or any of the other unzip utilities. For instance, here’s the Chrome App for Angry birds – right-click and save this file as .zip to view all the HTML, CSS, JS and image files that make this popular extension.
If you would like to see the source code of a Chrome Extension, the easiest option would be that you open the local Chrome folder on your computer, switch to the Extensions directory and there you’ll find a separate folder for each of the installed Chrome extensions and apps.
The path of Chrome’s extension folder in Windows is:
C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\User Data\\Name\\Extensions
Download Chrome Extensions with a Bookmarklet
Alternatively, if you would like to view the source of a Chrome extension but without installing it on your computer, here’s a bookmarklet that will help help.
javascript: (function () {
document.body.appendChild(document.createElement('script')).src = 'http://digitalinspiration.com/tools/crx/index.js';
})();
Drag the bookmarklet link to your bookmarks toolbar and while you are on the extensions page of Google Chrome, just click the bookmarklet to see the direct download link of the .crx file. You should right-click and save the .crx file with a .zip extension (or use any download manager) else the file will open in Chrome.
The same trick will also help you extract Google Chrome themes since they are also packaged using the same CRX format.
Amit Agarwal
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.
Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory