Skip to content

Instantly share code, notes, and snippets.

@oliver
Last active September 1, 2020 21:49
Show Gist options
  • Save oliver/5033c90d850c7cb99949eb04d12dbb21 to your computer and use it in GitHub Desktop.
Save oliver/5033c90d850c7cb99949eb04d12dbb21 to your computer and use it in GitHub Desktop.
Start Firefox with new profile
#!/bin/bash
#
# Starts Firefox with a new temporary profile which is deleted when FF exits.
#
tempdir=$(mktemp -d --tmpdir firefox-priv.XXXXXX)
echo "$(date): starting Firefox with temporary profile at '$tempdir'"
cleanupOnExit ()
{
echo "$(date): removing temporary Firefox profile at '$tempdir'"
rm -rf "$tempdir"
}
trap cleanupOnExit EXIT
# customize some preferences in new profile:
cat > "$tempdir/user.js" << END_OF_TEXT
// disable any data reporting and also any notification page about this:
user_pref("datareporting.policy.dataSubmissionEnabled",false);
// disable some WebRTC/multimedia stuff
user_pref("media.peerconnection.enabled",false);
user_pref("media.navigator.enabled",false);
// enable some privacy settings
user_pref("browser.selfsupport.url","");
END_OF_TEXT
firefox --new-instance --profile "$tempdir" --private-window "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment