Start Chrome with a temp profile & with preinstalled extension
Start Chrome with a temp profile
All Chrome Incognito windows share the same profiles, which make it harder when you need to debug a web application using more then 2-3 accounts on the time. Using this script i create a temp profile folder and start chrome pointing to it. I also had to do a small change to the default Chrome installation to auto-install the AdBlock extension.
#!/bin/bash BASE_TEMP_DIR=/tmp TEMP_DIR=$(mktemp -d $BASE_TEMP_DIR/google-chome.XXXXXXX) echo "Running Chrome with temp folder in: $TEMP_DIR" google-chrome --user-data-dir=$TEMP_DIR --no-first-run rm -rf $TEMP_DIR
Preinstall extension
Edit the file – `/opt/google/chrome/default_apps/external_extensions.json`
I also removed all the default Google Apps, and replaced it content with
// Dictionary of default apps to install into new profiles. Each entry maps // the extension's id to its crx's path (relative to this file) and the version // of the extension contained in the crx. // // When an extension is added or removed here, the two lists 'default_apps_list' // and 'default_apps_list_linux_dest' in build/common.gypi must also be updated. { "cfhdojbkjhnklbpkdaibdccddilifddb" : { // Load from a local file // "external_crx": "/path/to/file/adblock.crx", // "external_version": "1.0" // Install on launch "external_update_url": "https://clients2.google.com/service/update2/crx" } }
Download Chrome CRX file
As for how to download the CRX file, a short Goggle search gave me this answer (which doesn’t work for me anymore — Updated 2014-12-17),
wget http://clients2.google.com/service/update2/crx\?response\=redirect\&x\=id%3D[your-extention-uid]%26uc%26lang%3Den-US\&prod\=chrome e.g - For AdBlock wget http://clients2.google.com/service/update2/crx\?response\=redirect\&x\=id%3Dcfhdojbkjhnklbpkdaibdccddilifddb%26uc%26lang%3Den-US\&prod\=chrome
Something else you can do is to install the extension from Goggle App Store, and then on the extension page > Enable “Developer mode” > And use “Pack Extension”, which will create the CRX file for you.
And here is a snippet of code I use
{ // https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en "cjpalhdlnbpafiamejdnhcphjbkeiagm": { "external_update_url": "https://clients2.google.com/service/update2/crx" }, // https://chrome.google.com/webstore/detail/umatrix/ogfcmafjalglgifnmanfmnieipoejdcf?hl=en "ogfcmafjalglgifnmanfmnieipoejdcf": { "external_update_url": "https://clients2.google.com/service/update2/crx" }, "": {} }
Resources
- http://www.chromium.org/administrators/pre-installed-extensions
- http://peter.sh/experiments/chromium-command-line-switches/
- http://stackoverflow.com/questions/7184793/how-to-download-a-crx-file-from-the-chrome-web-store-for-a-given-id
- http://www.madhur.co.in/Reverse%20Engineering/Chrome/2011/06/03/reverseengineerchrome.html
You were the only person in whole internet to explain how to start Chrome with a preinstalled extension, thanks a lot!
glad I was able to help 🙂
please not that you need a internet connection to download the extension you like to install, if you like it to work offline, you will need to install the extension and then copy the files (crx).