My hack use for Chrome's Incognito mode

November 22, 2013

These days I have a script that starts Chrome in Incognito mode (or at least opens another window if Chrome is already running, which I am starting to arrange). It looks like this:

#!/bin/sh
exec google-chrome --incognito --new-window "$@"

(Note that --new-window is an undocumented option and thus may change someday.)

I don't do this because I like Chrome or because I need anonymity that often (and anyways my testing Firefox is about as equally anonymous). I do this because Chrome has an extremely valuable option for Incognito mode: you can turn off specific extensions if you want to (more exactly you have to enable extensions to run in Incognito mode). I use this to turn off NotScripts and FlashBlock and all of the other Chrome extensions that protect me from the unfiltered Internet in its natural crud-infested state.

In other words, Chrome's Incognito mode has become my 'just make this stuff work, I don't care any more' browser (especially as Chrome integrates its own supported version of Flash so I don't have to worry about that part either). And just like my testing Firefox, I don't have to worry very much about being contaminated by cookies and whatnot because Chrome throws them all away afterwards.

(Note that Chrome only discards cookies et al from your Incognito windows when all of them have been closed. If you keep one around for some reason, perhaps because it is running some important internal app for you, those cookies will live on for the duration.)

I would prefer to do this in Firefox and in theory I could do it with another profile for my testing Firefox (one that didn't have the relevant extensions installed). However I've never gotten alternate profiles to work very well in Firefox and I'd still have the Flash issues. In the mean time Chrome Incognito is convenient for this.

(I've even modified my custom environment so that I can dump an URL into 'ichrome' as easily as I can into my regular Firefox session. It's a bit sad that I use it (or need to use it) that often, but I do and it is oh so convenient.)

PS: writing this up was inspired by this tweet by @saintaardvark, which led to me discovering that I'm not alone in using Chrome Incognito for this.


Comments on this page:

By Frank Ch. Eigler at 2013-11-22 10:59:04:

Have you considered making a separate firefox profile, for this kind of purpose, one that lacks the usual safety-oriented plugins/settings?

By Seth at 2013-11-22 12:42:28:

And everyone here thinks I'm a privacy loon for doing similar things with my browsers. For comparison/ideas:

Completely anonymous sessions in chrome (chromium on fedora), with no extensions, config, etc.

 #!/bin/sh
 cfg=/tmp/chromeconfig.$$
 mkdir ${cfg}
 touch "${cfg}/First Run"
 /usr/bin/chromium-browser --incognito --user-data-dir=${cfg}
 rm -r ${cfg}

I'm really fond of my firefox config, though. Multiple profiles, completely separated (personal, work, high-security, ...). The heart of each wrapper script looks like

 export HOME=${HOME}/.mozilla.work ; cd
 exec firefox -no-remote "$@"

Which also keeps a private copy of flash cookies/config in the private HOME. Then each firefox gets its own extensions and config, has separate cache and cookies. One "temp" profile is configured to save no history or cookies. One profile is configured to run proxied through an ssh tunnel.

I do this as well, and additionally use http://www.darktrojan.net/software/addons/openwith to move pages from Firefox to Chromium.

By cks at 2013-11-22 13:59:30:

The problem with Firefox is that if you have multiple Firefox profiles active simultaneously there is no (reliable) way to open a second window for a specific profile from the command line. If you run the new Firefox with -no-remote it just fails with 'Firefox is already running'; if you run without it, Firefox will remote-open in a more or less random already-running profile. In theory this is not supposed to happen (the new Firefox is supposed to distinguish which already-running Firefox to remote-control based partly on the profile); in practice, it does.

(This problem is of course worse if you vary $HOME instead of changing profiles, because then all Firefoxes think that they are the same and will happily remote-control each other even under the best of circumstances.)

Chrome and Chrome Incognito get this right. You can start a new Chrome Incognito window when you have a running Chrome instance (incognito or otherwise). Of course this may not work if you set -user-data-dir; I wouldn't be surprised if all such Chromes considered themselves equal.

None of this matters if you don't remote-control and reuse existing running instances of your browsers, but I do this all of the time.

PS: looking at the actual Firefox code involved, it seems that it might work if you always use a non-default profile name and never try to use the default profile. I'll have to try this.

By Seth at 2013-11-22 14:17:08:

My experience is that not having a default profile running, the oldest running firefox gets the remote.

You're right that I don't use remote-control. I do keep the browsers running for a long time, and there's a default profile running without the -no-remote. I just treat that one as general browsing and all the others as specialized, pasting or typing URLs as needed.

I do this with Firefox -- I wrote a script that starts Firefox with a throwaway profile, which it generates by copying an existing "foxtemp-template" profile and removes once it's done: foxtemp, offog.py.

My usual Firefox profile has NoScript etc. installed, and I've got foxtemp bound to a key combination so I can easily bring up a vanilla browser when I need it.

Written on 22 November 2013.
« test is surprisingly smart
You are not fooling us with broken bounce addresses »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Fri Nov 22 01:24:22 2013
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.