How to view source code of Chrome extension

Extensions adds new functionalities for any browser and the extensions for chrome you install on your PC were actually built out of the special zip file which contains files and folders. Browser extensions were developed using Javascript and other resources. You might want to look into the source code of the extension to see its functionality and to audit them before installing them on the browser. This will be especially in the cases like if you don’t know the author of the extension or if it is offered by the third party publisher.

Fortunately, there is a way to view the source code of an extension before installing it. There are two methods to view the source code, first method is finding the chrome extension source code on your Hard Drive and another one is using Chrome extension source code viewer.

How to view source code of Chrome extension

Find chrome extension source code on Hard drive

This method is used to see the source code of extension that are currently installed on the Google Chrome browser.

  • Type chrome://extensions/ in the address bar of the Google chrome or click on three horizontal lines present on top right corner of Chrome and click on More tools and then click on Extensions.
  • Now in the extensions page, tick the checkbox named Developer mode at the top right side of the window and find the ID for extension which you need the source code for.
  • Now copy the ID of the extension which you need to open the Windows Explorer by pressing WIN key and E at same time.
  • In the Windows explorer enter the following into the location bar.
    %localappdata%
  • Now navigate through Google > Chrome > User Data > Profiles > Extensions. In few cases Profile folder may be called like Profile 1, just to keep in mind while you browse on.

CRX

  • Here you will see bunch of folders with long names and one of the them will match the extension ID which you are looking for.
  • After entering this folder, you will find another folder named with the version of extension. Double click on that icon again and you will find the files and folders that are associated with the extension’s source code.

Using Chrome extension source viewer

This method requires to download Chrome Extension source viewer extension, which let you to see the source code of any extension in the Chrome store. Once this extension is installed, you will get a popup confirmation dialog box.

  • After installing this go to Google Chrome store and view the source code of any app. Click on the yellow icon in the location bar and you will be asked either to download it as a zip file or view it online.
  • If you download the zip file, unzip the file and view it any regular text file viewer. If you like to see the source code online, then you will see the code in new tab in browser.

CRX-viewer

That’s it, these are the two methods to view the source code of any chrome extension.

You may also like...