3

On executing the command jupyter notebook, notebook opens on Mozilla Firefox.

How to open notebook on incognito mode of Mozilla Firefox from command line?

hanugm
  • 1,127
  • 3
  • 13
  • 44

3 Answers3

3

In your config add the following to set the default browser to a private firefox (adapted from here and parameters from there):

jupyter_notebook_config.py
[...]
## Specify what command to use to invoke a web browser when opening the notebook.
#  If not specified, the default browser will be determined by the `webbrowser`
#  standard library module, which allows setting of the BROWSER environment
#  variable to override it.
import webbrowser
webbrowser.register('private_firefox', None, webbrowser.get('"' + 'path/to/firefox' +'" -private %s'))
c.NotebookApp.browser = 'private_firefox'
[...]

where path/to/firefox would be something like one of these

  • /usr/bin/firefox for Linux (see here)
  • /Applications/Firefox.app/Contents/MacOS/firefox for macOS (see this)
  • C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe for Windows (as described here)

note:
Other browsers like Chrome ("...\\chrome.exe" --incognitoas in the source) would work analogously, I suppose. I have not tested others. Feel free to comment, if there are any hurdles.

Community
  • 1
  • 1
BadAtLaTeX
  • 614
  • 1
  • 9
  • 22
0

Typically Jupyer opens on http://localhost:8888 all you need to do is copy that url and open it yourself in an incognito Firefox session.

Eoin Murray
  • 1,935
  • 3
  • 22
  • 34
  • I don't think there is a way since jupyter just opens in your computers default browser - how come it needs to be a command line based solution? – Eoin Murray Feb 14 '18 at 21:44
0

On Safari, if the focus is on an incognito window, the notebook will open automatically in it.

Emy
  • 817
  • 1
  • 8
  • 25