Unsafe Chrome Sometimes Necessary

In my work – every now and then – I found myself in need of a browser with reduced security checks (mainly to gloss over cross domain XMLHttpRequests and SSL certificate violations) for testing purposes. I didn’t want to take the risk and use my main browser session with these settings, so I made me a script (also available as a Gist). 🙂

#
# Author: Riyad Preukschas <riyad@informatik.uni-bremen.de>
# License: Mozilla Public License 2.0
#
# Loads an unsafe (i.e. with several security features disabled) instance of
# Chrome with a temporary profile (i.e. all data is lost once Chrome is closed)
chrome-unsafe() {
# for Homebrew Cask (see http://caskroom.io/) compatibility
local -a CHROME_PATHS
CHROME_PATHS=( \
"/opt/homebrew-cask/Caskroom/google-chrome-dev/latest/Google Chrome.app/Contents/MacOS/Google Chrome" \
"/opt/homebrew-cask/Caskroom/google-chrome/latest/Google Chrome.app/Contents/MacOS/Google Chrome" \
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
"chrome" \
"chromium" \
)
local CHROME="${CHROME_PATHS[1]}"
while [[ -n CHROME_PATHS ]] && ! type ${CHROME} > /dev/null; do
shift CHROME_PATHS
CHROME="${CHROME_PATHS[1]}"
done
local DATA_DIR="$(mktemp -d -t 'chrome-unsafe_data_dir.XXXXXXXXXX')"
# for a listing of command line switches see:
# https://peter.sh/experiments/chromium-command-line-switches/
"${CHROME}" \
--disable-bundled-ppapi-flash \
--disable-popup-blocking \
--disable-sync \
--disable-web-security \
--ignore-certificate-errors \
--no-default-browser-check \
--no-first-run \
--non-secure \
--user-data-dir="${DATA_DIR}" \
$@ >/dev/null 2>&1 &!
# for now the window will not be brought to the front
}

Tip:
If you use oh my ZSH you can save this file in

~/.oh-my-zsh/custom/plugins/chrome-unsafe/chrome-unsafe.plugin.zsh

and add “chrome-unsafe” to your list of used plugins in

~/.zshrc

 

Chrome Beta for Android

I just installed Chrome Beta for Android and I must say it’s slick. It’s fast and its UI gets out of the way. Their solution for tab switching is nice too. It will keep as many tabs open as possible, it it needs to free space, it will save a screenshot and unload the tab. If you switch back you will see the screenshot while the page reloads in the background … nice trick I must say. 🙂

I hope Firefox Mobile can catch up with those tricks. Especially at start up. It seems Chrome uses the same trick for start up too. It must be, because it does not use Android’s built in browser engine so it must load its own at startup and this is no small piece … but they have solved this very well … kudos.