Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

Option 2: Use the CRX Viewer website

https://robwu.nl/crxviewer/

Option 3: Use the CRX Viewer extension

The Chrome extension source viewer is open source (github repo) and makes this super easy.

Option 3: View source of locally installed extension

  1. Find your Chrome local profile directory. Open chrome://version/ and find the "Profile Path:` field. Open that folder up.
  2. Open the Extensions/ subfolder
  3. All your extensions are here, with typically readable source.

Mapping between locally installed extension IDs and names

  • On about:extensions, turn on Developer Mode and you'll see IDs under each entry
  • Inside the Extensions/ folders, the manifest.json has a readable name field

image

@figital

This comment has been minimized.

Copy link

figital commented Aug 26, 2015

Thanks Paul this looks super handy.

@serkanh

This comment has been minimized.

Copy link

serkanh commented Aug 28, 2015

Thanks Paul.

@kyriakos

This comment has been minimized.

Copy link

kyriakos commented Aug 28, 2015

thanks!

@kel

This comment has been minimized.

Copy link

kel commented Aug 28, 2015

Awesome, thanks.

@Rob--W

This comment has been minimized.

Copy link

Rob--W commented Aug 28, 2015

Hi @paulirish, I was wondering where the surge of stars on my repository came from, and ended up at this gist :)

For the command-line URL, use prodchannel=stable instead of prodchannel=unknown, for the reason given in https://github.com/Rob--W/crxviewer/issues/20.

@paulirish

This comment has been minimized.

Copy link
Owner Author

paulirish commented Oct 10, 2015

@Rob--W thx! updated to stable.

@loretoparisi

This comment has been minimized.

Copy link

loretoparisi commented Oct 16, 2017

@paulirish I have found that some extensions does not download its contents (i.e. the background.js is a void file). Any idea?

@km3r

This comment has been minimized.

Copy link

km3r commented Mar 14, 2018

the file i got seems to be a ".crx" file which couldnt be opened by 7-zip or windows explorer until i renamed the extension to ".crx" or ".tar"

@amarilindra

This comment has been minimized.

Copy link

amarilindra commented Jun 12, 2019

Another easy way is getting the source code from your own hard disk. You need to first install the extension though.

Copy the ID of extension and navigate to the following path:

Windows: C - Users - [USER NAME] - AppData - Local - Google - Chrome - User Data - Default - Extensions
Mac: /Users/[USER NAME]/Library/Application Support/Google/Chrome/Default/Extensions

Here you will find a folder named with the ID of extension and it contains the complete source code.
Source: Geek Dashboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.