1

No matter what I do, jupyter notebook always opens in chrome non-incognito mode. This is my jupyter_notebook_config.py file

## 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.
#  Default: ''

import webbrowser
webbrowser.register('incognito-chrome',None, webbrowser.get("C:/Program Files/Google/Chrome/Application/chrome.exe %s --incognito"))
c.ServerApp.browser = 'incognito-chrome'

Please help

sirj
  • 145
  • 1
  • 8
  • Does this answer your question? [Run jupyter notebook in incognito window](https://stackoverflow.com/questions/48787973/run-jupyter-notebook-in-incognito-window) – Sys.Overdrive Oct 26 '21 at 06:02
  • @Sys.Overdrive that was the first stack overflow question i opened. and i copied all the code from it and just tweaked it to be google chrome incognito. however, it didnt work – sirj Oct 27 '21 at 03:44

1 Answers1

1

Another way of opening an incognito chrome window is as below:

import webbrowser as wb
jUrl = 'http://localhost:8888' #Default jupyter host
incongnito_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s --incognito'
wb.get(incongnito_path).open_new(jUrl)

This works for me!

Nishant Patel
  • 1,334
  • 14
  • 22
  • hi, so let me get this clear, there's no way to configure the file so that the browser opened is chrome incognito? because the solution you gave me basically opened a chrome incognito tab, on top of another, regular chrome tab (because the default configurations were never changed) – sirj Oct 27 '21 at 05:51
  • @sirj Yes as of now this is the best thing you can do. But i will try in my local to see if the jupyter-settings can be tweaked to make it work on jupyter app level, will keep you posted here. – Nishant Patel Oct 30 '21 at 03:50